I am having a problem in my sprite kit app where my NSUserDefaults
variable is not working. In createSceneContents
(which I know is being called)>
To store:
NSString * str = @"name123";
NSUserDefaults *def=[NSUserDefaults standardUserDefaults];
[def setObject:str forKey:@"Key"];
[def synchronize];
NSLog(@"str = = %@",str);
To Retrieve:
NSUserDefaults *def=[NSUserDefaults standardUserDefaults];
NSString *str2 = [def valueForKey:@"Key"];
NSLog(@" Saved str = = %@",str2);