Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS 5.1 Simulator "Documents" ghost directory
    primarykey
    data
    text
    <p>Before I start, I need to stress the fact that I have looked at every post dealing with the documents directory. </p> <p>So I will try to disect my problem to better help you help me.</p> <p>I am developing an iOS application targeted for 5.1. I am using XCode 4.4.1 and the iOS simulator Version 5.1 (272.21).</p> <p>It is in my understanding that when an app is installed in the simulator, its directory structure is mapped under </p> <pre><code>/Library/Application Support/iPhone Simulator/[IOS_VERSION]/Applications/[APP_UUID] </code></pre> <p>This is properly reflected when I run my application.</p> <p>Furthermore I am able to successfully create and use a temporary directory using the following code </p> <pre><code>NSString *tmpDir = NSTemporaryDirectory(); </code></pre> <p>which results in the following path</p> <pre><code>/Library/Application Support/iPhone Simulator/[IOS_VERSION]/Applications/[APP_UUID]/tmp </code></pre> <p>The problem starts appearing when I want to work with the <strong>Documents</strong> directory that is supposed to be in </p> <pre><code>/Library/Application Support/iPhone Simulator/[IOS_VERSION]/Applications/[APP_UUID]/Documents </code></pre> <p>The following code checks for the existence of that path, and then logs it using NSLog, and even though it says it exists navigating to that location returns a file not found.</p> <pre><code>+ (NSString *) currentPath{ NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentPath = [searchPaths objectAtIndex:0]; searchPaths=nil; BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:documentPath]; if (fileExists == TRUE) { NSLog(@" %@ already exists",documentPath); } else { NSLog(@"doesn't exists"); NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; if(![fileManager createDirectoryAtPath:documentPath withIntermediateDirectories:true attributes:nil error:&amp;error]) { NSLog(@"Couldn't create documents directory %@",error); } } return documentPath; } </code></pre> <p>The result is of the NSLog line is:</p> <pre><code>2012-08-09 23:12:09.813 AMM[22656:c07] /Users/fotis/Library/Application Support/iPhone Simulator/5.1/Applications/7CE8645A-BDD7-4AB6-8CAB-B0EF1579CD2B/Documents already exists </code></pre> <p>In the terminal</p> <pre><code> &gt; pwd /Users/fotis/Library/Application Support/iPhone Simulator/5.1/Applications/7CE8645A-BDD7-4AB6-8CAB-B0EF1579CD2B &gt;ls -lsa total 0 0 drwxr-xr-x 5 fotis 170 Aug 9 23:12 . 0 drwxr-xr-x 3 fotis 102 Aug 9 22:50 .. 0 drwxr-xr-x 30 fotis 1020 Aug 9 23:12 AMM.app 0 drwxr-xr-x 4 fotis 136 Aug 9 22:50 Library 0 drwxr-xr-x 4 fotis 136 Aug 9 22:51 tmp </code></pre> <p>As you can see, my <strong>Documents</strong> ghost directory is not there. For the life of me I cannot understand the magic behind it all. One thing to note is that I am running this in the "-didFinishLaunchingWithOptions" method of my app delegate, because I am doing some initialization there.</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload