NSHTTPCookieStorage

2020. 11. 24. 23:14개발자료/iOS


반응형

# 전체 조회

for(NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) {
	NSLog(@"%@", [cookie description]);
}

# URL지정 조회

NSURL *url = [NSURL URLWithString:@"https://wonyount2.tistory.com"];
for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:url]) {
	NSLog(@"%@", [cookie description]);
} 

 

# 등록

NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
[cookieStorage setCookie:cookie];

# 삭제

NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
[cookieStorage deleteCookie:cookie];

 

 

반응형