objective c - How to retrieve images from server asynchronously -


i have 1 nsmutablearray image url's. images have sizes between 12kb 6mb. use asycimageview class , implement when large images downloading application crashed, gave 6*1024*1024 (6mb) maxsize in class, increase time interval 60.0 sec 180.o sec, there no use. i'm getting error "received memory warning" , when app crash automatically connection remove device, in simulator there no crash.

use gcd lazy loading.

dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_high, 0ul);  dispatch_async(queue, ^{        nsstring *strurl = url here;        nsdata *data = [nsdata datawithcontentsofurl:[nsurl urlwithstring:strurl]];        uiimage *image = nil;        if(data)         image = [uiimage imagewithdata:data];       dispatch_sync(dispatch_get_main_queue(), ^{            //now use image in image view  or anywhere according requirement.            if(image)              yourimgview = image       });  }); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -