ASIHTTPRequest crashes the app on ios8

孤人 提交于 2019-12-08 01:17:56

问题


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,

  1. http://afnetworking.com/
  2. https://github.com/AFNetworking/AFNetworking
  3. http://www.raywenderlich.com/59255/afnetworking-2-0-tutorial


来源:https://stackoverflow.com/questions/26094471/asihttprequest-crashes-the-app-on-ios8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!