1

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?

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Mangesh
  • 2,257
  • 4
  • 24
  • 51
  • The files for the apps are added to the document directory – Akhilesh Sharma May 23 '12 at 10:01
  • Apple will approve app ? – Mangesh May 23 '12 at 10:05
  • You can save to your app's document directory, or [to the standard iPhone Camera Roll](http://stackoverflow.com/a/2552950/119114). Both are acceptable (by Apple). – Nate May 23 '12 at 10:05
  • Thanks Nate but one of my app rejected due to data storage guideline http://stackoverflow.com/questions/8818117/application-rejected-because-of-not-following-ios-data-storage-guidelines – Mangesh May 23 '12 at 10:25
  • Why did you delete [your previous question](http://stackoverflow.com/q/10704214/19679) asking the same thing after I had cleaned up the wording? Please don't do that, because it's severely annoying. – Brad Larson May 23 '12 at 16:53
  • Sorry Brad, will careful for next time. Thanks – Mangesh May 25 '12 at 06:09

2 Answers2

1

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.

shoughton123
  • 4,255
  • 3
  • 21
  • 23
  • Thanks Friend, will ALAssetsLibrary allow image sharing with itune? Apple will approve app? And if user delete image from ALAssetsLibrary then?? – Mangesh May 23 '12 at 10:22
  • Yes it will, it will also allow use of photo stream. Yes apple will approve it...its there library. If the image is deleted then you try to access it with a url the ALAssetsLibrary will return nil which you then handle appropriately. – shoughton123 May 23 '12 at 10:37
  • Thanks, I asked client for the same but he doesn't want to show images (Taken by App) in image library. If i use document directory and set tag "DO not backup" then ? – Mangesh May 23 '12 at 10:59
  • You can use the document directory but I have seen apps get rejected for saving images into the document directory. – shoughton123 May 24 '12 at 11:35
1

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

Warif Akhand Rishi
  • 23,920
  • 8
  • 80
  • 107
  • Thanks Warif, Recently Apple reject my app, can you please describe little more. Thanks http://stackoverflow.com/questions/8612133/app-rejected-for-storing-database-in-documents-directory – Mangesh May 23 '12 at 11:11
  • For Database may be the best place is not Documents Directory. Our app didn't had database. As far as I know if you want to Itunes file sharing you have to put file in documents directory (sandbox). Library doesn't have iTunes File sharing. **FileHider FileBackup iCameraFrame** all apps are using documents directory never had any issue with apple. – Warif Akhand Rishi May 23 '12 at 12:04
  • +1 for detail description. iLL try this and let you know. DO not back up tag needed ? – Mangesh May 23 '12 at 12:19
  • Thanks :-) Our requirement was user may not enable current location. We didn't use AssetsLibrary frameWork. Actually what we did is picking a single image but picker not dismissed, so user could pick multiple images. I don't have any idea about back up tag. – Warif Akhand Rishi May 23 '12 at 12:42