Tag: asihttprequest

使用Asihttprequest和iPhone的Json框架parsingJSON数据

我一直在学习如何使用JSON框架和iOS的ASIHTTPRequestparsingJSON。 我已经通过社区教程testing了使用twitter feed以及定制feed。 一切进展顺利。 然后我想我会testing使用Microsoft Odata服务Northwind分贝。 你可以在这里查看json的结果: http://jsonviewer.stack.hu/#http://services.odata.org/Northwind/Northwind.svc/Products%281%29?$format=json 现在我正在努力研究如何parsing产品名称。 任何人都可以指向正确的方向吗? 在我的要求已完成,我有这样的 : – (void)requestFinished:(ASIHTTPRequest *)request { [MBProgressHUD hideHUDForView:self.view animated:YES]; NSString *responseString = [request responseString]; NSDictionary *responseDict = [responseString JSONValue]; //find key in dictionary NSArray *keys = [responseDict allKeys]; NSString *productName = [responseDict valueForKey:@"ProductName"]; NSLog(@"%@",productName); } 在日志中我有空。 如果我将valueForKey更改为@"d" ,则获得整个有效内容,但是我只想要productName。 我使用的服务url是: http://servers.odata.org/Northwind/Northwind.svc/Products(1)?$format=json

已弃用“kCFStreamSSLAllowsExpiredCertificates”和“kCFStreamSSLAllowsAnyRoot”

我已经添加了“ASIHTTPRequest”库到我的应用程序。 现在,我试图删除我的项目中的所有警告。 除了“ASIHTTPRequest”以外,我已经修复了所有其他警告。 我收到下面的警告。 已弃用“kCFStreamSSLAllowsExpiredCertificates”: 已弃用“kCFStreamSSLAllowsAnyRoot”: 如何解决这个问题? 码: NSDictionary *sslProperties = [[NSDictionary alloc] initWithObjectsAndKeys: [NSNumber numberWithBool:YES], kCFStreamSSLAllowsExpiredCertificates, [NSNumber numberWithBool:YES], kCFStreamSSLAllowsAnyRoot, [NSNumber numberWithBool:NO], kCFStreamSSLValidatesCertificateChain, kCFNull,kCFStreamSSLPeerName, nil];

ASIHTTPRequest傻瓜

我在ASIHTTPRequest中是完整的DUMMY。 我刚刚下载了库,并将其添加到我的项目,现在我正在尝试了解使用它的基本知识。 我在这里find了一些很好的例子 这个小教程是关于上传图像到服务器。 我试过了,事情似乎工作(但我与[请求responseString]返回的NSString,它返回整个网页的HTML代码混淆),但我想知道如何下载图像(或上传的任何东西)从服务器。 经过search,我发现这一点 ,它给了我没有答案,但只有更多的问题,因为这是我不清楚。 让我来回答我的问题: 1)请给我提供一段代码,说明如何从服务器上下载数据(不pipe是什么types的数据:图像,string,数字等)? 2)我应该知道服务器端的php代码才能使用服务器吗? 3)如果是的话 – 我如何知道服务器端的PHP代码? 4)如果一个请求是由一个PHP脚本或任何其他手段进行处理,这有多重要? 5)responseString的作用是什么? 它可以返回给我一个巨大的HTML代码吗? 6)主要问题。 有没有一个很好的教程ASIHTTPRequest? 像“ASIHTTPRequest for dummies”? 我在这里find官方文档,但它解释的东西真的很差,我只是找不到任何其他教程。 任何帮助迫切需要。

访问Google阅读器的terminalAPI时出错

我试图在iPhone APP中实现谷歌阅读器,到目前为止,我已经成功地收到了SID和身份validation 。 当我尝试使用GET调用Endpoints API时,问题就出现了。下面是代码: ASIHTTPRequest *request = [self requestForAPIEndpoint:@"https://www.google.com/reader/api/0/subscription/list?output=json"]; [request setDelegate:self]; [request startAsynchronous]; – (ASIHTTPRequest *) requestForAPIEndpoint: (NSString *) apiEndpoint { ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString: apiEndpoint]]; [request addRequestHeader: @"User-Agent" value: @"YourClient"]; [request addRequestHeader: @"Cookie" value: signature]; NSLog(@"Sig = %@",signature); [request addRequestHeader: @"Authorization" value: autho]; return request. } autho和签名被正确设置。 不过每次我都会在 – (void)requestFailed:(ASIHTTPRequest *)请求方法中得到callback。 […]

将用户标识存储在内存IOS中

我用一个loginfunction做了一个IOS应用程序。 我使用ASIHTTPRequest来检查用户是否存在于MySQL数据库中。 所有工作正常,但我想通过其他viewcontrollers用户名或检索它的应用程序的其他部分。 有人能把我推向正确的方向吗?如何以最好和最安全的方式做到这一点? 这是我对PHP脚本执行POST HTTP请求的方式: ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"*SOME_URL*"]]; 在callback中,我可以检索用户ID,但是我想将此ID存储在应用程序的内存中以供进一步使用。 谢谢。

由于libWeANDSFLibrary.a(ASIReachability.o)​​的重复符号链接器错误

我正在使用ASI ( ASIHTTPRequest , ASIDownloadCache , Reachability等)请求。 现在在我的项目中,我正在使用reachability.h和.m文件。我添加了一个第三方库,在那个库中我知道他们也在使用ASI库。 但据我所知,他们使用ASIReachability类而不是Reachability 。 所以我也加了.h文件。 仍然我收到链接器错误,说: duplicate symbol _kInternetConnection in: /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o) duplicate symbol _kLocalWiFiConnection in: /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o) duplicate symbol _kReachabilityChangedNotification in: /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o) duplicate symbol _kConnectionDown in: /Users/goutham.v/Library/Developer/Xcode/DerivedData/My_TWCable-fyaebjpvvaprmgdgtirhzshodpky/Build/Intermediates/My TWCable.build/Debug-iphonesimulator/My TWCable.build/Objects-normal/i386/Reachability.o /Users/goutham.v/Desktop/SVN/TWC_BC/12Mar2014_TWCBC/weandsf/iphonesimulator/libWeANDSFLibrary.a(ASIReachability.o) ld: 4 duplicate symbols for architecture i386 clang: error: linker command […]

ASIHTTPRequest请求超时

我一直在研究这个问题很长一段时间,我不确定如何着手解决这个问题。 我有一个简单的ASIHTTPRequest。 代码在下面发布。 我第一次运行该应用程序时总是有效的。 我有一个表格视图,我可以拉刷新,这启动ASIHTTPRequest,我可以刷新多less次,因为我喜欢与出问题。 我可以发送应用程序的背景,把它带回来,一切工作正常。 但是,如果我离开应用程序几个小时,然后回来,有时我会开始收到一个请求超时错误。 一旦发生这种情况,每当我尝试刷新时都会重复出现此错误,而且如果不实际closures应用程序并重新启动它,我将无法再次进行连接。 我不相信问题是与我的url,因为它可以卡在一台设备上,而在另一台设备上罚款。 我从来没有能够在模拟器上得到超时错误。 我可以想象,为什么我可能会得到一次错误的时间,但我不明白为什么一旦开始,错误不会停止。 我真的不知道在哪里寻求解决这个问题,或者我怎么去debugging它。 注意我目前在我的应用程序中使用TestFlightLive,GoogleAnalytics和Urban Airship可能是相关的。 也许这些库中的一个对我的networking行为造成了问题? 这里是代码: – (void)getData { NSURL *url = [NSURL URLWithString:@"http://www.mysite.com/appname/latestData.py?callback=?"]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDelegate:self]; [request setTimeOutSeconds:20.0]; [request startAsynchronous]; } – (void)requestFinished:(ASIHTTPRequest *)request { NSData *responseData = [request responseData]; DLog(@"requestFinished entered"); NSString *dataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; // […]

在UIWebView中加载HTTPSurl

我开始iPhone编程,我有很大的问题,我不能解决。 所以,我有一个UIWebview ,我可以加载HTTPurl没有问题: NSString urlAdress; urlAdress = @"http://servername"; NSURL *url = [NSURL URLWithString:urlAdress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [webView loadRequest:requestObj]; 它的工作,我的页面加载在我的UIwebView,但是当我replace: urlAdress = @"http://servername"; 通过 urlAdress = @"https://servername"; 我有空白的屏幕。 我读了它的正常,但有没有简单的方法来加载我的web视图的url? 我读了关于ASIHTTPRequest但我没有到达实施它。 我只想加载HTTPSurl 。

为什么我更喜欢NSURLConnection的ASIHTTPRequest从网上下载文件?

我见过几次使用ASIHTTPRequest来下载文件的人。 现在我想知道为什么? NSURLConnection的核心优势是什么?

如何使用ASIHTTPRequest来跟踪上传/下载进度

我有一个问题是使用ASIHTTPRequest来跟踪上传/下载进度 这是来自ASIHTTPRequest网站的样本 ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDownloadProgressDelegate:myProgressIndicator]; [request startSynchronous]; NSLog(@"Max: %f, Value: %f", [myProgressIndicator maxValue],[myProgressIndicator doubleValue] 它说: myProgressIndicator是一个NSProgressIndicator。 但它看起来像苹果已弃用NSProgressIndicator 在这里检查 所以…我怎么知道上传/下载进度? 另一个问题是…如果上传/下载在任务完成之前终止 如何让上传/下载任务继续从停止点(中断点?)开始? 非常感谢〜