how to copy a data file to documents folder on device

Discussion in 'iOS Programming' started by tomkirk, Apr 27, 2009.

  1. tomkirk macrumors newbie

    Apr 27, 2009
    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:
  2. kainjow Moderator emeritus


    Jun 15, 2000
    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.
  3. tomkirk thread starter macrumors newbie

    Apr 27, 2009
    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.

Share This Page