mercredi 3 décembre 2014

Save more than one NSData files to documents folder in iOS

I want to save multiple images to my documents path folder. My web service returns more than one image url path and i want to save each image to my documents folder.This process working successfully, but my view FREEZES at this time(converting image url to NSData).I am using following code.How to avoid this issue?



NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:[[usersArray objectAtIndex:i]objectForKey:@"message"]]];
NSString *localImgpath = [directoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.%@",imageName, @"png"]];
[data writeToFile:localImgpath atomically:YES];



Aucun commentaire:

Enregistrer un commentaire