清除iPhone模拟器cookie [英] Clear iPhone simulator cookies

查看:454
本文介绍了清除iPhone模拟器cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序向 REST 服务发出请求。使用cookie完成身份验证。这已经有效了。

I have an app that makes request to a REST service. Authentication is done using cookies. This already works.

我遇到的问题是当cookie不再有效且我的代码必须重新认证时测试案例。为了测试这个,我必须等到cookie无效,这可能需要一些时间。为了加快这一点,我想如果我删除cookie就会产生相同的效果。

What I have problems with is to test the case when the cookie is no longer valid and my code has to reauthenticate. To test this I have to wait until the cookie is invalid, which could take some time. To accelerate this I figured that if I delete the cookie it would have the same effect.

如何在iPhone模拟器上删除应用程序的所有cookie?

How to delete all cookies of an app on the iPhone simulator?

我已经尝试过以下内容:

I already tried the following:

删除< app-dir> /Library/Cookies/Cookies.binarycookies不会工作。似乎我的cookie从未写入此文件。

Deleting <app-dir>/Library/Cookies/Cookies.binarycookies doesn't work. It seems that my cookies are never written to this file.

在应用启动时删除NSHTTPCookieStorage中的所有cookie也不起作用。

Deleting all cookies in NSHTTPCookieStorage on app startup doesn't work either.

推荐答案

Cookie位于:

/ Users /< ; YourUsername> / Library / Application Support / iPhone Simulator /< iOSversion> /Library/Cookies/Cookies.binarycookies

/Users/<YourUsername>/Library/Application Support/iPhone Simulator/<iOSversion>/Library/Cookies/Cookies.binarycookies

您可能需要退出Safari(在快速应用程序切换区域中),然后将其删除,以便Safari不会将它们存储在内存中。

You may need to quit out of Safari (in the fast app switching area) and then delete them so Safari won't have them in memory.

这篇关于清除iPhone模拟器cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆