有什么方法可以清除应用安装过程中存储的所有数据? [英] Is there any way to clear all data stored from the installation of app?
本文介绍了有什么方法可以清除应用安装过程中存储的所有数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个iOS应用程序,该应用程序将数据存储在NSUserDefults
中,并且由于Web视图负载,社交媒体签名等原因,许多其他数据已在缓存中设置.
我想从应用程序创建的缓存中删除所有数据.
I have an iOS app which stores data in NSUserDefults
and many other data is set in cache as a result of web view load, social media signing etc.
I want to remove all the data from cache created by the app.
在iOS中有什么方法可以通过编程方式做到这一点吗?
Is there any way to do this programmatically in iOS?
推荐答案
尝试
NSString *appDomain = [[NSBundle mainBundle] bundleIdentifier];
[[NSUserDefaults standardUserDefaults] removePersistentDomainForName:appDomain];
或
[[NSUserDefaults standardUserDefaults] setPersistentDomain:[NSDictionary dictionary] forName:[[NSBundle mainBundle] bundleIdentifier]];
这篇关于有什么方法可以清除应用安装过程中存储的所有数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文