I am trying to work directories. Unfortunately i get a non-writeable directory when I run NSSearchPathForDirectoriesInDomains. What I get is:
/Users/me/Library/Application Support/iPhone Simulator/User/Documents
When I run other people's examples I get:
/Users/me/Library/Application Support/iPhone Simulator/User/Applications/6958D21C-C94B-4843-9EF1-70406D0CA3A3/Documents
which is writeable.
The snippet of the code used is
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog(documentsDirectory);
What do I need to do allow me to get the same long directory structure?
That long path with the GUID is the documents path for your app, and is expected behavior.
Not sure what your code looks like, but getting the path to your app's document directory should be something like:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
(From Mark/LaMarche p. 331)
since it searches for the "object at index:0"
NSString *documentsDirectory = [paths objectAtIndex:0];
there could be a directory starting with a letter smaller than "d" for documents. Which becomes the "object at index:0". I know this might not be possible but It could be true as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With