views:

602

answers:

2

Hi,

I have noticed that my application's Document folder is sometimes different.

The workflow was following:

  1. I started writing files into Document folder (File Set A).
  2. And it appeared empty one time.
  3. So I decided to write files again (different files) (File Set B).

After the Simulator sometimes starts with files of Set A and sometimes with files of Set B.

Is it usual logic for Simulator or this could be some critical error of my application?

Thanks.

A: 

I believe that whats going on here is that you have two application directories or sand boxes for your iphone simulator and it picks the first one it finds, you can delete them where the iphone simulator keeps it app data (i cant r emember the path of the top of my head its osmething like Library=>device support=>iphone simulator not sure tho)

Daniel
A: 

Your active configuration determines what locations are used for your app filesystem. Look at the code below to see how to get your document directory.


    NSArray *paths = NSSearchPathForDirectoriesInDomains(
        NSDocumentDirectory, 
        NSUserDomainMask, YES); 

NSString* documentDir = [paths objectAtIndex:0];


documentDir should be your document directory.

Iggy