It may be a small issue. or I might have done something wrong but couldn't track it. please help.
I have created an application and have stored the userToken and few flags in NSUserDefaults
. The app was working fine till yesterday. but today when I opened the app for further development, all the stuff stored in NSUserDefaults
are suddenly coming null
. I didn't change anything. and also installed the app again to resave the data. But nothing. I am lost why this is happening.
I am on iOS 9.3.4 with Xcode Version 7.3.1 (7D1014)
here's my code
in ViewCongtroller1.m :
NSUserDefaults *def = [NSUserDefaults standardUserDefaults];
[def setValue:@"user1" forKey:@"Usertoken"];
[def synchronize];
and in ViewController2.h :
NSUserDefaults *def ;
in ViewController2.m :
def = [NSUserDefaults standardUserDefaults];
NSLog(@"Token = %@",[def valueForKey:@"Usertoken"]);
and here's the response
Token = (null)
Please help me guys. Thanks in Advance,