问题
Here I am using JSON to parse the data with ASIHTTPRequest
The same code is working fine for my lower version of iOS. (iOs7 & below)
But I am not able to run this on my iOS-8 device.
The log is getting well, but the app crashes, may be getting late reply from server. It should not crash for late reply.
Does any new modification required for iOS-8 for ASIHTTPRequest
?
Same code for lower version working well.
If I tried to check with debugger ON with each method, I found my code is crashing right here:
-(void)startSynchronous
{
#if DEBUG_REQUEST_STATUS || DEBUG_THROTTLING
ASI_DEBUG_LOG(@"[STATUS] Starting synchronous request %@",self);
#endif
[self setSynchronous:YES];
[self setRunLoopMode:ASIHTTPRequestRunLoopMode];
[self setInProgress:YES];
if (![self isCancelled] && ![self complete]) {
[self main];
while (!complete) {
[[NSRunLoop currentRunLoop] runMode:[self runLoopMode] beforeDate:[NSDate distantFuture]];
}
}
[self setInProgress:NO];
}
In while loop app crashes. Am I doing something wrong...?
Thanks in Advance.
回答1:
I know, the answer has been put there in the Questions' comment, but following is my explanation!
I was wondering why these people still use AsiHTTP for their projects. It's been deprecated and also abandoned by its developer before or around iOS 5 and iOS 6!!! I've also used AsiHTTP library too, but that's only when I was learning to develop iOS apps and that's only for studying purpose only!
Better start using something like AFNetworking, a very easy to use networking library, which supports both iOS and Mac OS X both!
See the following links,
- http://afnetworking.com/
- https://github.com/AFNetworking/AFNetworking
- http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial
来源:https://stackoverflow.com/questions/26094471/asihttprequest-crashes-the-app-on-ios8