I'm developing an iOS app that needs to download an image to display it the next time if the app has no internet connection.
I get the URL to download this image from a request to a server, I get a json back with a field "image" with the url of the image. To download and store this image I do the following:
NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:utfString]];
[data writeToFile:[NSString stringWithFormat:@"%@/%@",documentsDirectoryPath,@"superPremio"] atomically:NO];
This is called inside a successfully server call block. So I'm not doing this synchronously. This server call is being made in the viewDidLoad
of the view controller that needs to display the image. This view controller has a UIScrollView and this scroll view is experimenting a lag when the image is written to the memory. Everything is done in background processing so I'm not sure why this is happening... any idea?
Thanks!