Where should I save images in my iPhone app?
I am developing an application for iphone that will pick an image from photo library and save it at some other place.Now in my application i will be using this image later on from that place.
So can anybody suggest the fol开发者_如何学运维der where should i save this image so that the application works perfectly on device also.
You want to save it your applications Documents or Library folder. See the Files and Networking Programming Guide and specifically something like:
"Listing 6-1 Getting a file-system path to the application’s Documents/ directory:"
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
Have a look at this snippet http://snipplr.com/view/28080/save-image-example/, each application has a 'Documents' folder where you could save the image too.
You would save it to the applications document or library folder. If you want the user to have access to it on the iPad, put it in the documents folder. If only code will access it, put it in the library folder.
精彩评论