Clear iPhone simulator cookies

前端 未结 6 1085
野趣味
野趣味 2021-02-06 10:35

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

What I have problems with is to test the case when the cook

6条回答
  •  滥情空心
    2021-02-06 11:19

    You'll probably find better luck doing this in the SDK code rather than modifying file systems. Try:

        //Delete previous cookies
        NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
        for (NSHTTPCookie *each in [[[cookieStorage cookiesForURL:YOUR_URL] copy] autorelease]) {
            [cookieStorage deleteCookie:each];
        }
    

提交回复
热议问题