I have this code after a remote call is made and
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] ;
NSString *responseError = [[NSString alloc] initWithData:error encoding:NSUTF8StringEncoding] ;
...
And on the last line sometimes the code crashes. I can not reproduce the crash, but one guess I have is that if the error object is nil then the crash happens, am I right? Should I check if error is not nil first?
This is the error from crashalytics:
Reason:
-[NSURLError bytes]: unrecognized selector sent to instance 0x22b215d0
which does not support my guess of why the error happens. Any idea why this crash happens?
Thanks!