Iphone SDK: Can write data in plist on Simulator, but can not do the same on the device?

Why can I write simulation information on a simulator

But can not do this on a real iphone / ipod device ????

Is there an absolute path for placing a .plist file in an xcode project ???

Thanks for the answers and answers ~

code: this is how I write text for plist from a text field

NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"Password" ofType:@"plist"];
NSMutableDictionary *propertyList = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
[propertyList setValue:serialNumber.text forKey:@"serial_number"];
+3
source share
1 answer

You can only write to your isolated application folder. Below is a function that will return the path to the Documents folder for your application.

- (NSString *)applicationDocumentsDirectory
{
    return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
}
+1
source

Source: https://habr.com/ru/post/1773807/


All Articles