tags:

views:

41

answers:

1

In my app I store some user data in two .plist files which already contain some data, but the user can change it.

NSString *Path = [[NSBundle mainBundle] bundlePath];

NSString *DataPath = [Path stringByAppendingPathComponent:@"Settings.plist"];

NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] initWithContentsOfFile:DataPath];

It works on the Simulator, but not on the device.

Can you help me, please?

Thank you!

+2  A: 

You can't write to the bundle on the device, so you need to get the path to your Documents or Library directory.

- (NSString*)applicationDocumentsDirectory
{
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        return [paths lastObject];
}
calmh
Thank you, but how can I do it?
Knodel
Thank you! I'll try that
Knodel
Yeah, sorry for the short first answer, I hit save while I was looking for the code. :)
calmh