I have set a bool value for key TCshow in my NSUserDefault,
I want to run a nslog test whether the key is saved or not, and i m trying to printout the bool value.
here is my code but it s not working, any suggestions?
- (IBAction)acceptAction:(id)sender {
//key store to nsuserdefault
self.storedKey = [[NSUserDefaults alloc] init];
[self.storedKey setBool:YES forKey:@"TCshow"];
//trying to print out yes or not, but not working...
NSLog(@"%@", [self.storedKey boolForKey:@"TCshow"]);
}
%@is for objects.BOOLis not an object. You should use%d.It will print out
0for FALSE/NO and1for TRUE/YES.