Jason
Jason

Reputation:

How do I put files into the Documents folder in xcode for iPhone development?

I would like to put some sample images in the applications Documents directory. Can I put these somewhere in my xcode project or do I have to programmatically add them to the Documents folder from the project resources?

Users will be able to add their own images (which will be written to the Documents folder) and I would prefer not to access the sample images separately, I just want them to be pre-seeded in the Documents folder (I'm assuming resources in xcode aren't stored there in the first place?).

Upvotes: 13

Views: 14471

Answers (3)

terry franguiadakis
terry franguiadakis

Reputation: 140

I just looked into the same thing. When you put a file in your Resources, it will be part of your app bundle. Which for me is fine, because it's a data file (html). For you, you would have to read it from the bundle, and save it into the document folder when the app runs.

Upvotes: 1

Aler
Aler

Reputation: 15567

This link might be helpful for you http://www.iphonedevsdk.com/forum/iphone-sdk-development/12014-save-file-directly-into-documents-directory-xcode.html

I also looking answer to that question.

Upvotes: 2

Alex Wayne
Alex Wayne

Reputation: 187252

I think you will need to add the images to your app, and then copy them over on the first boot of the app. Just check if they exist (or set a boolean flag in the settings or something) in applicationDidFinishLaunching and create the images you need from there.

Upvotes: 3

Related Questions