forked from Feynmen/UnityHttp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iOSCoockieStorageHelper.mm
24 lines (22 loc) · 1016 Bytes
/
iOSCoockieStorageHelper.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#import <Foundation/NSObject.h>
#import <Foundation/NSNotification.h>
extern "C" void ClearIOSCookieByValue(const char *cookie)
{
NSString *cValue = [NSString stringWithUTF8String:cookie];
NSLog(@"ClearIOSCookieByValue Value - %@", cValue);
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for(NSHTTPCookie *each in cookieStorage.cookies)
{
NSString *value = [NSString stringWithFormat:@"%@=%@", each.name, each.value];
NSLog(@"ClearIOSCookieByValue CookieStorageItem - %@", value);
if (cValue == value)
[cookieStorage deleteCookie:each];
}
}
extern "C" void ClearAllIOSCookies()
{
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for(NSHTTPCookie *each in cookieStorage.cookies)
[cookieStorage deleteCookie:each];
NSLog(@"ClearAllIOSCookies");
}