清除WEBVIEW COOKie
2016-07-18 15:07
766 查看
-(void)clearWebViewCookie{
// UIWebView清除Cookie:
//清除cookies
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage
sharedHTTPCookieStorage];
for (cookie
in [storage cookies])
{
[storage deleteCookie:cookie];
}
// UIWebView清除缓存:
//清除UIWebView的缓存
[[NSURLCache
sharedURLCache] removeAllCachedResponses];
NSURLCache * cache = [NSURLCache
sharedURLCache];
[cache removeAllCachedResponses];
[cache setDiskCapacity:0];
[cache setMemoryCapacity:0];
}
// UIWebView清除Cookie:
//清除cookies
NSHTTPCookie *cookie;
NSHTTPCookieStorage *storage = [NSHTTPCookieStorage
sharedHTTPCookieStorage];
for (cookie
in [storage cookies])
{
[storage deleteCookie:cookie];
}
// UIWebView清除缓存:
//清除UIWebView的缓存
[[NSURLCache
sharedURLCache] removeAllCachedResponses];
NSURLCache * cache = [NSURLCache
sharedURLCache];
[cache removeAllCachedResponses];
[cache setDiskCapacity:0];
[cache setMemoryCapacity:0];
}
相关文章推荐
- android权限
- Android Drawable、Bitmap、byte[]之间的转换
- MVP模式在Android项目中的使用
- 升级Android studio 2.1.2 签名出错
- iOS开发~CocoaPods使用详细说明
- ios中timer相关的延时调用需要注意的地方
- 学习笔记-斯坦福iOS7-第五课:视图控制器生命周期
- Android获取WebView的UserAgent
- FileMapping
- Unity中的Path对应各平台中的Path
- butterknife:8.0.1 在android studio 中可以注册,运行时报空指针问题
- Android EventBus实战 没听过你就out了
- cocos2dx 解决texture packer导出的图片程序中拼接有黑边的问题
- 学习笔记-斯坦福iOS7-第四课:框架和带属性字符串
- java.lang.NullPointerException at android.support.v4.app.FragmentManagerImpl.sav
- [绍棠] iOS开发常用的调试命令
- Error: Error parsing F:\android-sdk_r24.3.4-windows\android-sdk-windows\system-images\android-23\and
- android seekbar 注意事项
- Objective-C Category 的实现原理
- 41.计算两个时间之间的间隔时间