Hi all, I want to save the loaded image from server in idle time.I use the following to to save image in iPhone memory.
- (void)saveImage:(UIImage *)image withName:(NSString *)name
{
NSData *data1 = UIImageJPEGRepresentation(image, 1.0);
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:name];
[fileManager createFileAtPath:fullPath contents:data1 attributes:nil];
if (image==nil) {
NSLog(@"Not Saved...:%@",name);
}
}
but when his method called i got halt time....i don't want that...i want to save image when iPhone is inactive.....can help??
Thanks