清除NSUserDefaults的数据
作者:
魔力双鱼 | 来源:发表于
2019-06-20 19:15 被阅读0次
方法一:
- (void)resetDefaults {
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
NSDictionary * dict = [defaults dictionaryRepresentation];
for(id key in dict) {
[defaults removeObjectForKey:key];
}
[defaults synchronize];
}
方法二:
NSString *appDomain = [[NSBundle mainBundle]bundleIdentifier];
[[NSUserDefaults standardUserDefaults]removePersistentDomainForName:appDomain];
本文标题:清除NSUserDefaults的数据
本文链接:https://www.haomeiwen.com/subject/mdxsqctx.html
网友评论