UserDefault

来源:互联网 发布:电信光猫iptv端口连接 编辑:程序博客网 时间:2024/06/09 20:11

To reset the NSUserDefaults to the standard values use:

[NSUserDefaults resetStandardUserDefaults];[NSUserDefaults standardUserDefaults];

If you want to delete every key use the following:

NSDictionary *defaultsDictionary = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];for (NSString *key in [defaultsDictionary allKeys]) {    [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];}[[NSUserDefaults standardUserDefaults] synchronize];

原创粉丝点击