Mangesh
Mangesh

Reputation: 2285

Where should I store images so that I can use iTunes file sharing with them?

My iOS app takes pictures from both the photo gallery and the camera, but I'm not sure where to store them. I'd like to present these images to the user via iTunes file sharing.

Should I store them in the app's Documents directory or would that lead to a rejection by Apple?

Upvotes: 1

Views: 304

Answers (2)

shoughton123
shoughton123

Reputation: 4251

Use the ALAssetsLibrary to save the images, if you want those images saved in your app you just need to store the asset urls in the document directory.

Apple will tend to reject apps that are saving large files into the document directory unnecessarily i.e. saving lots of images into the document directory.

Upvotes: 1

Warif Akhand Rishi
Warif Akhand Rishi

Reputation: 24248

Save file in doc directory

#define ROOT_FOLDER_PATH        [NSString stringWithFormat:@"%@", [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,NSUserDomainMask, YES)objectAtIndex:0]]    

-(BOOL)savePhoto:(NSData*)photoData:(NSString*)photoName
{
NSString *fullFilePath = [NSString stringWithFormat:@"%@/%@", ROOT_FOLDER_PATH, photoName];
return [photoData writeToFile:fullFilePath atomically:YES];
}

In Plist enable Application Supports iTunes File Sharing. That's all. :-)

We have an app like this. Apple will approve. No problem

Upvotes: 1

Related Questions