在 NSUserDefaults 中查找重复项
Finding recurring items in NSUserDefaults
我很难理解如何找到重复不止一次的值。我只是不明白下面的代码如何获取重复值。感谢您的帮助!!
[appDelegate.scannedNumbers addObject:result];
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:appDelegate.scannedNumbers forKey:@"scannedNumbers"];
[userDefaults synchronize];
[BT_debugger showIt:self message:[NSString stringWithFormat:@"After writing scannedNumbers: %@" [[NSUserDefaults standardUserDefaults] objectForKey:@"scannedNumbers"]]];
Setting a default has no effect on the value returned by the objectForKey: method if the same key exists in a domain that precedes the application domain in the search list.
在为同一键设置另一个对象之前,您必须检查该键是否已经存在。
我很难理解如何找到重复不止一次的值。我只是不明白下面的代码如何获取重复值。感谢您的帮助!!
[appDelegate.scannedNumbers addObject:result];
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:appDelegate.scannedNumbers forKey:@"scannedNumbers"];
[userDefaults synchronize];
[BT_debugger showIt:self message:[NSString stringWithFormat:@"After writing scannedNumbers: %@" [[NSUserDefaults standardUserDefaults] objectForKey:@"scannedNumbers"]]];
Setting a default has no effect on the value returned by the objectForKey: method if the same key exists in a domain that precedes the application domain in the search list.
在为同一键设置另一个对象之前,您必须检查该键是否已经存在。