I am trying to store a single an email address for an application in the plist file. It works fine on the simulator, but it doesn't work on my iPhone. Here is my code:
code to view what is in the .plist
code to write to the .plist
"write file was found" shows properly in the log when I run the app on my phone. Any idea why this appears to write properly on the simulator and not the phone? Anyone else run into this?
code to view what is in the .plist
Code:
//code to retrieve info from plist
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"Info.plist"];
NSDictionary *plistData = [[NSDictionary dictionaryWithContentsOfFile:finalPath] retain];
NSString *emailString = [NSString stringWithFormat:@"%@", [plistData objectForKey:@"savedEmail"]];
fromEmailInput.text = emailString;
NSLog(emailString);
code to write to the .plist
Code:
NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *propList = [path stringByAppendingPathComponent:@"Info.plist"];
NSMutableDictionary* plistData = [[NSMutableDictionary alloc] initWithContentsOfFile:propList];
if (plistData) {
NSLog(@"write file was found");
[plistData setValue:fromEmailInput.text forKey:@"savedEmail"];
[plistData writeToFile:propList atomically: YES];
}
"write file was found" shows properly in the log when I run the app on my phone. Any idea why this appears to write properly on the simulator and not the phone? Anyone else run into this?