两种方法删除NSUserDefaults所有记录
//方法一
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
];
}
posted on 2015-07-24 13:54 yucaijiang 阅读(316) 评论(0) 编辑 收藏 举报