Really odd problem I'm having: dataWithContentsOfURL has begun returning an error code 256 over cellular, but not over wifi.
The operation couldn’t be completed. (Cocoa error 256.)
I do indeed have a cellular data connection, and it is functioning, so it is not a problem with my cellular connection. Plus the code works fine on wifi, so the basic code is not the issue. The code in question is:
dispatch_queue_t queue = dispatch_queue_create("com.appName.FetchImage", DISPATCH_QUEUE_SERIAL);
dispatch_async(queue, ^{
...
NSURL *url = [NSURL URLWithString:[urlString stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]];
NSLog(@"URL: %@", url);
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
NSError *error = [[NSError alloc] init];
NSData *imgData = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:&error];
if (error) NSLog(@"Error loading data: %@", error);
UIImage *image = [UIImage imageWithData:imgData];
...
});
Any thoughts? I'm at a loss as to why this might be happening. It also occurs with the vanilla dataWithContentsOfURL (as opposed to with options).