NSUserDefaults重置 [英] NSUserDefaults reset
本文介绍了NSUserDefaults重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们可以同时为所有密钥重置NSUserDefaults吗?
现在我重置个别密钥。所以,如果有一种方法可以一次性完成,请告诉我。
Can we reset NSUserDefaults for all the keys at the same time? Right now I reset for individual keys. So if there is a way to do that in a single go please tell me.
谢谢
推荐答案
以下是如何在不循环所有值并删除它们的情况下执行此操作。
Here is how to do it without looping over all values and removing them.
NSString *domainName = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:domainName];
这篇关于NSUserDefaults重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文