ios – NSUserDefaults是否包含值?

NSUserDefaults是否包含任何值?如何检查是否为空?
没有办法检查NSUserDefault是否为空。但是您可以检查特定键的值是否存在..

NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];

NSObject * object = [prefs objectForKey:@"your_particular_key"];
if(object != nil){
   //object is there
}
翻译自:https://stackoverflow.com/questions/9206263/nsuserdefaults-contains-value-or-not

转载注明原文:ios – NSUserDefaults是否包含值?