iOS 中删除cookie的正确做法
需求:删除 qq 登录的 cookie,保证下次打开 qq 登录页面不会默认登录
实现:
NSString *url =@"https://w.mail.qq.com/cgi-bin/loginpage?
f=xhtml&kvclick=loginpage|app_push|enter|ios&ad=false&f=xhtml";//qq登录的
url
NSString *urlString =[url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSArray * cookArray = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:urlString]];
for (NSHTTPCookie *cookie in
cookArray)
{
if ([cookie.domain containsString:@"qq.com"])
{
[[NSHTTPCookieStorage sharedHTTPCookieStorage] deleteCookie:cookie];
}
}
iOS 中删除cookie的正确做法的更多相关文章
- 遍历List过程中删除元素的正确做法(转)
遍历List过程中删除元素的正确做法 public class ListRemoveTest { 3 public static void main(String[] args) { 4 ...
- javascript删除Cookie的正确方法(转载)
原来一直以为只要设置javascript的document.cookie对象就能简单的在浏览器端设置和删除cookie值,网上很多文章也是这么教的,但是最近发现简单的设置javascript的docu ...
- Web Api 中返回JSON的正确做法
在使用Web Api的时候,有时候只想返回JSON:实现这一功能有多种方法,本文提供两种方式,一种传统的,一种作者认为是正确的方法. JSON in Web API – the formatter b ...
- Web Api 中返回JSON的正确做法(转)
出处:http://www.cnblogs.com/acles/archive/2013/06/21/3147667.html 在使用Web Api的时候,有时候只想返回JSON:实现这一功能有多种方 ...
- [转】Python--遍历列表时删除元素的正确做法
转自:https://blog.csdn.net/cckavin/article/details/83618306 一.问题描述 这是在工作中遇到的一段代码,原理大概和下面类似(判断某一个元素是否 ...
- 遍历list时删除元素的正确做法
我们往往会遇到需要删除list中满足条件的元素.举例: List<string> list_str =new List<string>() { "A",&q ...
- 关于设置了setMaxAge(0)而浏览器未成功删除Cookie的注意事项
最近做了个系统,其中涉及到对Cookie的操作.当用户登录时,设置一些数据到Cookie中,用户登出系统的时候删除写入浏览器中的对应Cookie.问题就出在登出系统时,在firebug中看到需要删除的 ...
- iOS 中UIWebView的cookie
有关cookie是什么,大家可以自行百度,本文我获得cookie的目的是得到一个userID. 下面的是代码. - (void)getUserIDFromCookie { NSHTTPCookieSt ...
- 自己实现FormsAuthentication.SetAuthCookie方法,怎样在ASP.NET服务端代码中删除客户端Cookie
如何手动设置AuthCookie ASP.NET中实现可以自己实现FormsAuthentication.SetAuthCookie方法,控制更为灵活 /// <summary> /// ...
随机推荐
- centos上安装supervisor来管理dotnetcore等应用程序
supervisor 介绍: 这是一款用python编写的进程管理工具,可以守护他管理的所有进程,防止异常退出,以及提供一个可视化的web界面来手动管理,打开关闭重启各种应用,界面如下: 关于在cen ...
- 基于spring 3.0mvc 框架的文件上传实现
Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块.使用 Spring 可插入的 MVC 架构,可以选择是使用内置的 Spring Web 框架还是 Struts 这样的 Web 框 ...
- oracle数据库定时备份
现有需求,设计一批处理文件,实现周一全部备份,周二周三周五周六增量备份,周四周日累计备份.并且每日将上个月本日数据删除(如今日8月7号,则删除7月7号的数据).并将备份压缩以减小所占空间. 思路: 备 ...
- HDU_1176_免费馅饼
http://acm.hdu.edu.cn/showproblem.php?pid=1176 参考自:http://blog.csdn.net/xcszbdnl/article/details/787 ...
- HDU6189 Law of Commutation (数论)
题意:输入n和a 定义m等于2的n次方 求1-m有多少数使得 a^b = b^a (mod m) 题解:先打表找规律 发现a为奇数的答案只有b = a这一种 (不知道为什么也不想知道为什么 当a为偶数 ...
- idea_复制包名类名
- you have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'varchar(255), sort integer not null
you have an error in your SQL syntax; check the manual that corresponds to your MySQL server version ...
- MySql的存储过程和触发器
Mysql的存储过程是类似于其它编程语言中的函数的功能,存储过程内部可以使用顺序循环和转移三种基本程序结构,而且整个存储过程可以接受和返回参数. 创建存储过程(procedure)时,因为其内部有以; ...
- win10 ubuntu 子系统安装php
apt-get install python-software-propertiesadd-apt-repository ppa:ondrej/phpapt-get updateapt-get ins ...
- Linux下常用的操作
Linux下常用的操作 文件定位 locate filename 有些版本的linux会出现 -bash: locate: command not found错误,不要慌,安装一下mlocate包就好 ...