Question

I have a scenario where a NSURLConnection is in progress.

As we all know, CDMA phones (think Verizon, Sprint) can't handle data and phone calls at the same time. Does anyone know what, if any, NSError is returned when the connection is interrupted by a phone call?

Is there any error handling? Does didFailWithError get called or does it automatically go into the background?

Thank you in advance.

Was it helpful?

Solution

This is a good question. While I do not know the answer to this case specifically but if you implement this NSURLConnection function:

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error

And run your code on a device debugging with xcode, you should be able to see for yourself.

edit:

Adding to the other answer, I found the list of all URL errors, so hopefully you can narrow down which one you're looking for. errors

pre-submission edit: I found it! The error is: NSURLErrorCallIsActive

Returned when a connection is attempted while a phone call is active on a network that does not support simultaneous phone and data communication (EDGE or GPRS).

OTHER TIPS

//connection:didFailWithError:error

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
 //handle error here
    if([error code] == NSURLErrorCallIsActive)//error code for NSURLErrorCallIsActive = -1019
    {
        //if we can identify the error
    }else{
        //otherwise handle the error generally
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top