//方法一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];}

本文提供了两种清除iOS应用中NSUserDefaults存储的偏好设置的方法。方法一通过应用标识符移除持久化域;方法二则遍历所有键并逐一删除。
797

被折叠的 条评论
为什么被折叠?



