我已经为我的NSUserDefault设置了一个键为TCshow的布尔值,
我想运行一个nslog测试,以确定是否保存了该键,并尝试打印出布尔值。
这是我的代码,但它没有起作用,有什么建议吗?
- (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"]);
}