How to parse data using ASIHttp request?

I am using webservices.I am sending request from iphone and retrieving data. I am using http request.But I want to use ASIhttprequest, so how is this possible?

+2


source to share


1 answer


You should look at the class ASIS3Request

for details on the subclass ASIHTTPRequest

and perform your own tasks before or after the request completes. Your own subclass will look something like this:

@interface MyFancySubclass : ASIHTTPRequest {}
@end

@implementation MyFancySubclass

- (void) main {
  // Perform pre-request initialisation here
  [super main];
}

- (void) requestFinished {
  // Parse [self responseString] or [self responseData] here
  [super requestFinished];
}

- (void) failWithError:(NSError*)theError {
  // Handle errors here
  [super failWithError:theError];
}

@end

      



If you add instances MyFancySubclass

to ASINetworkQueue

, parsing will be done from the main thread.

+2


source







All Articles