1. white89gt's Avatar
    I've been working on porting one of my apps from the SDK to be a jailbroken app, and the only problem that I'm running into is where to save my data files to. I've tried putting them several places and have tried setting permissions on them a couple of different ways and haven't had any luck. Can anyone tell me where they save their data files to and how they set the permissions on them?

    Thanks in advance.
    2008-07-27 06:44 PM
  2. esmandau's Avatar
    im looking for the same info here, i am doing this
    i want to figure out how to save data files (and where) and then if somebody knows about an ftp control for cocoa? iphone? i want to send these files via wireless to my servers database..... please help
    2008-07-28 05:15 AM
  3. NetMage's Avatar
    Preferences storage is built in, and you could use this for limited data storage as well - look up NSUserDefaults.

    Otherwise, you can store stuff in ~/Library/appName, accessed by using:
    [@"~/Library/AppName/appData.dat" stringByExpandingTildeInPath]

    For ftp, I would suggest seeing if you can use CFNetwork, specifically CFReadStreamCreateWithFTPURL and CFWriteStreamCreateWithFTPURL (assuming you are not going for AppStore)
    Starlight Computer Wizardry
    Pocket-sized Development
    Follow me on twitter: @NetMage
    2008-07-28 07:06 AM
  4. white89gt's Avatar
    Preferences storage is built in, and you could use this for limited data storage as well - look up NSUserDefaults.

    Otherwise, you can store stuff in ~/Library/appName, accessed by using:
    [@"~/Library/AppName/appData.dat" stringByExpandingTildeInPath]

    For ftp, I would suggest seeing if you can use CFNetwork, specifically CFReadStreamCreateWithFTPURL and CFWriteStreamCreateWithFTPURL (assuming you are not going for AppStore)
    I have saving and loading working fine for my builds that are properly signed with my developer certificate, however I've also been playing around with jailbroken stuff and file saving is giving me a few headaches, so thanks for the info. Also, do I need to do anything special to file permissions, or will fixing them through BossPrefs take care of any mis-matches?
    Last edited by white89gt; 2008-07-28 at 03:21 PM.
    2008-07-28 03:18 PM
  5. NetMage's Avatar
    I don't see why there should be any file permission issues - applications should run under the user 'mobile' and ~/Library should have the appropriate permissions to allow 'mobile' to create files...

    What are you concerned about?
    Starlight Computer Wizardry
    Pocket-sized Development
    Follow me on twitter: @NetMage
    2008-07-28 11:47 PM
  6. white89gt's Avatar
    I'm not concerned about anything, it's just that I haven't had any luck with saving files for jailbroken apps. I haven't had a chance to try your suggestion, but I'm sure it will work. I was just making sure that I didn't need to do anything special to make files "accessible" to any program that I'm writing.
    2008-07-29 04:46 AM
  7. white89gt's Avatar
    Just an update for anyone that might be trying to do the same thing that I've been working on.

    NetMage's suggestion worked, but I didn't have to make sure to chown everything to mobile:mobile before the program would open and save the file.
    2008-07-30 06:22 AM
  8. cleverapps's Avatar
    Here is an example of how to get the Documents directory path: HowToUseEntropyDB - entropydb - Google Code - Sample code of using EntropyDB
    2008-08-06 12:38 AM
LINK TO POST COPIED TO CLIPBOARD