清除NSUserdefault内容
作者:
西博尔 | 来源:发表于
2017-02-14 12:02 被阅读96次
//方法一
NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
//方法二
- (void)resetDefaults {
NSUserDefaults * defs = [NSUserDefaults standardUserDefaults];
NSDictionary * dict = [defs dictionaryRepresentation];
for (id key in dict) {
[defs removeObjectForKey:key];
}
[defs synchronize];
}
亲测第一种好用, 第二种没试
本文标题:清除NSUserdefault内容
本文链接:https://www.haomeiwen.com/subject/nsexwttx.html
网友评论