asihttprequest

AFNetworking - Download multiple files + monitoring via UIProgressView

杀马特。学长 韩版系。学妹 提交于 2019-12-03 02:51:55
问题 I am trying to change my code from ASIHTTPRequest to AFNetworking. Currently I want to select 10-15 different HTTP URLs (files) and download them to a documents folder. With ASIHTTPRequest that was pretty easy with [myQueue setDownloadProgressDelegate:myUIProgressView]; In AFNetworking I can't figure out how to do it. I have the following code which downloads the files, stores them and notifies when a file downloads successfully, but I can't create the progress bar for this queue with total

How SOAP and REST work with XML/JSON response?

只愿长相守 提交于 2019-12-03 01:23:31
问题 This is one very common question asked again and again on stack overflow and I read so many answers about this but I am still bit confused. I need to call the webservices from iPhone sdk. Here are my questions: I am not clear what response SOAP or REST return.Is there anything specific that if response is XML then we should use REST and if JSON we should use SOAP? What is the role of ASIHTTP with SOAP and REST? If I am getting XML response as <oproduct> <iid>113133791</iid> <icategoryid>270<

Good pattern for Internet requests with Grand Central Dispatch?

妖精的绣舞 提交于 2019-12-02 23:29:19
I'm currently using synchronous ASIHTTPRequest with GCD queues to download data from the Internet, then parse the response data with JSONKit. What do you think about this pattern. Thank you in advance. Here is my code: dispatch_async(queue, ^(void) { // Request is ASIHTTPRequest. [request startSynchronous]; // Parse JSON. NSArray *array = [[request responseData] objectFromJSONDataWithParseOptions:JKParseOptionLooseUnicode]; // Callback on the main queue to update UI. dispatch_async(dispatch_get_main_queue(), ^(void) { callbackBlock(array); }); }); EDIT: The reason I use ASIHTTPRequest is that

Error in accessing google reader's Endpoints API

爷,独闯天下 提交于 2019-12-02 19:38:09
问题 I am trying to implement google reader in iPhone APP and so far I have successfully received the sid and auth . The problem arises when I try to call the Endpoints API with GET .. Here's the code: 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

Generic approach to NSManagedObjectContext in multi-threaded application

不羁岁月 提交于 2019-12-02 19:30:01
I've read a number of posts here about NSManagedObjectContext and multi-threaded applications. I've also gone over the CoreDataBooks example to understand how separate threads require their own NSManagedObjectContext, and how a save operation gets merged with the main NSManagedObjectContext. I found the example to be good, but also too application specific. I'm trying to generalize this, and wonder if my approach is sound. My approach is to have a generic function for fetching the NSManagedObjectContext for the current thread. The function returns the NSManagedObjectContext for the main thread

iOS: handling HTTP request's unicode characters

若如初见. 提交于 2019-12-02 17:43:20
问题 When I NSLog HTTP requests response string, it appears as "ãÃÂïãÃâ¬ÃÂãÃÂÃâãÃÂ" and something different appears on UILabel but not the same as I expect in Japanese/Chinese format. I am using ASIHTTPRequest and as mentioned here I have set response encoding to NSUTF8StringEncoding(server uses UTF-8 same) but it didn't help. Could someone please tell me how to support unicode character in my App? Thanks. - (void)getData { ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL

AFNetworking - Download multiple files + monitoring via UIProgressView

折月煮酒 提交于 2019-12-02 16:25:49
I am trying to change my code from ASIHTTPRequest to AFNetworking. Currently I want to select 10-15 different HTTP URLs (files) and download them to a documents folder. With ASIHTTPRequest that was pretty easy with [myQueue setDownloadProgressDelegate:myUIProgressView]; In AFNetworking I can't figure out how to do it. I have the following code which downloads the files, stores them and notifies when a file downloads successfully, but I can't create the progress bar for this queue with total size. for (i=0; i<3; i++) { NSString *urlpath = [NSString stringWithFormat:@"http://www.domain.com/file

How SOAP and REST work with XML/JSON response?

◇◆丶佛笑我妖孽 提交于 2019-12-02 14:45:41
This is one very common question asked again and again on stack overflow and I read so many answers about this but I am still bit confused. I need to call the webservices from iPhone sdk. Here are my questions: I am not clear what response SOAP or REST return.Is there anything specific that if response is XML then we should use REST and if JSON we should use SOAP? What is the role of ASIHTTP with SOAP and REST? If I am getting XML response as <oproduct> <iid>113133791</iid> <icategoryid>270</icategoryid> <imerchantid>1547</imerchantid> <iadult>0</iadult> <sname>The Ashes / 1st Test - England v

Consuming Custom Request Methods with iOS5

家住魔仙堡 提交于 2019-12-02 12:27:53
问题 My original question regarding Consuming Custom Request Methods with Android seems to have garnered very little attention -- I have converted it to an Android specific question So, quite simply, with iOS5 development, is it possible to consume custom request methods? If so, how. The "standard" set of request methods, as per RFC-2616 are: GET PUT POST DELETE TRACE CONNECT I would like to add another, called SEARCH . On the API, using PHP or Java, this is easy to implement in PHP. The

Error in accessing google reader's Endpoints API

蹲街弑〆低调 提交于 2019-12-02 11:07:07
I am trying to implement google reader in iPhone APP and so far I have successfully received the sid and auth . The problem arises when I try to call the Endpoints API with GET .. Here's the code: 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: @