Once in a while when loading image like this:
dispatch_async(dispatch_get_global_queue(0, 0), ^
{
NSData *data = [[NSData alloc] initWithContentsOfURL:someImgUrl.jpg];
if (data == nil)
{
NSLog( @"data is nil with img url:%@" ,imgUrl);
return;
}
dispatch_async(dispatch_get_main_queue(), ^
{
img.image = [UIImage imageWithData:data];
});
});
my data is nil. I used fiddler to sniff that, and saw that everytime it happened no request is shown in fiddler!
The only times it NEVER happens are
Downloading the image synchronically:
NSData * imageData = [[NSData alloc] initWithContentsOfURL:someImgUrl.jpg ];
img.image = [UIImage imageWithData: imageData];
The way I initialize SignalR is this:
NSString *listenurl = [NSString stringWithFormat:@"%@/%@", SERVICE_URL, @"/echo"];
mConnection = [SRConnection connectionWithURL:listenurl];
[mConnection setDelegate:self];
[mConnection start:[[SRLongPollingTransport alloc] init]];
Anyone else use signalR client in ios and exprience this behaviour?
It seems that problem only happens when SignalR listens with the same domain name to the server where you try to load images from.
So the (lame) solution so far that I found is buy a second domain and listen to that one. Don't know why it happens though...