1

Hi in my app launch i will invoke a web-service call and i will download some zip files now i need to save those files permanently in my application bundle so that when i launch my app for the second time i will just look for update if there is no update i will just use my previously saved files, so i thought to make use of document directory and get the zip file then unzip it and save it in application bundle, here my problem is how to save a file from DocumentsDirectory to my Application Bundle? and does my approach is right & efficient way or do i need to follow some other ways to achieve this? Any help is thankful in advance.

1
  • 2
    Why do you want to move them out of the Documents directory, you can just use them from there.
    – mprivat
    Aug 8, 2012 at 13:30

2 Answers 2

4

You can't write to your application's bundle - it is readonly, only the documents directory is readwrite.

You don't need to move the files, as the documents directory provides permanent storage.

3
  • @jonathanlking thanks for the reply,if i save all unzipped data in documents directory once if i kill my app and relaunch it will it be there , i mean will documents directory store the data permanently?is it similar to sqlite storage? Aug 8, 2012 at 13:49
  • @GrahamBell Yes, it will always remain there until your app is deleted. I'm not sure what you mean about SQL storage, but it isn't a database if thats what you mean. If you want a database look at using Core Data. Aug 8, 2012 at 13:51
  • 1
    @jonathanlking sorry by mistakenly i clicked twice on accept control,,,:) Aug 9, 2012 at 5:04
4

The resources which are modified at runtime should be part of Documents directory. iPhone application creates a sandbox environment which is signed. If you try to modify any of the bundle resource or try to add/remove the resource, it will not allow. It works fine with simulator but not with device.

So you should store your response to the documents directory and not to the bundle.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.