views:

853

answers:

2

Hello. I am getting bald quite quick and need help!

I am writing an app which needs to access directories. I was hoping to get a path of the form /Users/me/Library/Application Support/iPhone Simulator/User/Applications/6958D21C-C94B-4843-9EF1-70406D0CA3A3/Documents.

However my app is giving me /Users/me/Library/Application Support/iPhone Simulator/User/Documents which is not what I want because have no write access.

Here is a thoroughly stripped down edition of my code. Note that you need to look at the console in the simulator to see the output. I have checked all the references I know and have no success to change the behaviour. Is it some compiler option? Or something I have to change in Info.plist? Anybody please...

Update: For some very strange reason my app is not being sandboxed. Why?

File DirTestAppDelegate.h

#import <UIKit/UIKit.h>

@interface DirTestAppDelegate : NSObject <UIApplicationDelegate> 
{
    UIWindow *window;
}

@end

File DirTestAppDelegate.m

#import "DirTestAppDelegate.h"

@implementation DirTestAppDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application 
{    
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    NSLog(documentsDirectory);
}


- (void)dealloc 
{
        [super dealloc];
}
@end
+2  A: 

It was an issue of the provisioning not set properly. Took hours to fix :-(

John Smith
Can you post the solution and let me know what you did? I'm having a similar problem getting the directory in the distribution configuration. Thanks - Joe
Buffernet
I would also love to hear your solution, I'm having the same problem.
Richard Poirier
+1  A: 

Please - what was the answer. I'm having the same problem and can't find anything about it.

Rob Cohen