iPhone SDK: Making application files stay

Discussion in 'Mac Programming' started by supersv, Apr 19, 2008.

  1. supersv macrumors newbie

    Joined:
    Apr 19, 2008
    #1
    Hi,

    Does anybody know how to make files inside an iPhone SDK app's directory survive simulator restart? The problem is Xcode puts the application under a random folder in ~/Library/Application Support/iPhone Simulator/User/Applications/ during each launch, and any files the app stored during the previous session are gone.

    Thanks.
     
  2. Littleodie914 macrumors 68000

    Littleodie914

    Joined:
    Jun 9, 2004
    Location:
    Rochester, NY
    #2
    I'm not really sure, I've wondered the same thing.

    And on a related note, how is application going to be maintained after an application upgrade? :confused:
     
  3. supersv thread starter macrumors newbie

    Joined:
    Apr 19, 2008
    #3
    I've got a temporary solution, to ease the debugging. The idea is to use external commands to copy files when application starts and store them away when it is about to terminate. It's kinda ugly, but it works.
     
  4. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #4
    Would serializing to SQLite work for your app?
     
  5. supersv thread starter macrumors newbie

    Joined:
    Apr 19, 2008
    #5
    Yes, it would, but doesn't SQLite store its data inside a file in app's dir as well?
     
  6. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #6
    I'm not sure. If it does and those files were removed, it doesn't seem very useful to have SQLite available.
     
  7. supersv thread starter macrumors newbie

    Joined:
    Apr 19, 2008
    #7
    It depends on how well your data fit the relational model.
     
  8. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #8
    What does that matter if the DB file is blown away every time your app exits?
     
  9. supersv thread starter macrumors newbie

    Joined:
    Apr 19, 2008
    #9
    It is blown away only when Xcode reinstalls your app in the simulator. When the app eventually gets to a real device, files will stay.
     

Share This Page