PDA

View Full Version : how to copy a data file to documents folder on device




tomkirk
Apr 27, 2009, 10:05 PM
I am a new developer and have a beta copy of my program working fine on the simulator. the program uses a lookup
file (table of values) that is a binary file. it would not work well in a property list or database file.
i currently have it in the documents folder on the mac. i have moved the app to the device and it works well
except the lookup table is not available. i have included it in the app bundle but still no luck. i believe it
needs to be in the documents folder for the app on the device. any help would be greatly appreciated.:rolleyes:



kainjow
Apr 27, 2009, 10:37 PM
You should put any read-only resources in your .app's bundle. If it's not working, maybe you're not using the right API? NSBundle should work just fine. The documents folder is for writing files. You can use NSSearchPathForDirectoriesInDomains() to find the path.

tomkirk
Apr 28, 2009, 08:31 PM
Thanks for the reply. I'm still confused about how to put my file into the bundle. I have copied it to the "Targets" folder in my project also into the "Executables" folder. I would also like to supply a sample file in the apps documents folder when the app is distributed so users will have a sample file to try out. Thanks again.