how to delete a image from iphone application

Posted by pankaj on Stack Overflow See other posts from Stack Overflow or by pankaj
Published on 2010-05-17T07:51:51Z Indexed on 2010/05/17 8:00 UTC
Read the original article Hit count: 189

Filed under:

I am working an iphone app where i am giving the option of downloading an image to user's iphone. Following is my code for downloading of image.

UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:urlAddress]]];
NSString *pngFilePath = [[[NSString stringWithFormat:@"%@/",docDir] stringByAppendingString:[NSString stringWithFormat:@"%@",couponID]] stringByAppendingString:@".png"];
NSData *data1 = [NSData dataWithData:UIImagePNGRepresentation(image)];
[data1 writeToFile:pngFilePath atomically:YES];

My above code works fine but now i want to give option of deleting the image downloaded from above code. Can some one please advice me how can i delete a image file from iphone.

© Stack Overflow or respective owner

Related posts about iphone