如何清除目标C中的应用程序缓存?

问题描述:

我正在构建一个iOS应用,其中我已经实现了Fabric并使用Digits进行登录.登录成功后,会话将保持打开状态.

I'm building an iOS app in which i have implemented Fabric and using Digits for login.When login is successful session remains open.

我遇到一个问题,我想清除应用程序缓存以重置会话,以便用户可以使用新的电话号码再次登录.

I'm facing an issue i want to clear the app cache to reset the session so user can login again with a new phone number.But it is not happening.

我用于清除应用程序缓存的代码:

The code i'm using to clear the app cache:

- (void)viewDidLoad {

    [super viewDidLoad];

    [[NSURLCache sharedURLCache] removeAllCachedResponses];

}

我们非常感谢您的帮助!

Help is appreciated!

您可以使用图书馆自己的高级机制,而不必陷入低级并弄乱NSURLCache的情况:

Rather than go low-level and mess with NSURLCache, you can use your library's own high-level mechanics:

[[Digits sharedInstance] logOut]