How to parse data using ASIHttp request?
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 to share