Question

In my app I use NSUserDefaults and I updated my iPhone to the latest iOS 7.0.2. From then, the app doesn't save the data I wanted to be saved in NSUserDefaults.

I remember that from iOS 5 you had to ask the user for permission, does it the case?

The following code, save the forgot password status, i.e 'send your email' -> 'waiting for code' -> 'success'

The user insert his email and gets an email with a code, after inserting the code he get to set his new password. My code is:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *temp = [defaults valueForKey:FORM_STATUS];

I have never needed to synchronise. The above code worked perfectly until IOS v7.0.2, and the bug is happening only on a real device. not on the simulator or a device with IOS 7.0. Yesterday I have used my iPhone to check it and in the evening I updated my device and checked again.

If someone remember from IOS 5 if you didn't ask permission to use the photos you couldn't see the modal view. I remember creating an app on that time that used the user photo library and it stopped working on a real updated device (on that time).

Was it helpful?

Solution

To Store :

NSString * Authkey = @"Sivarwin";
NSUserDefaults *storeData=[NSUserDefaults standardUserDefaults];
[storeData setObject:Authkey forKey:@"Key"];
NSLog(@"SYMBOL : %@",Authkey);

To Retrieve:

NSUserDefaults *storeData=[NSUserDefaults standardUserDefaults];
NSString *loginString = [storeData valueForKey:@"Key"];
NSLog(@"%@ Saved String ",loginString);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top