尝试为 ASIHTTPRequest 请求设置 cookie 时,我得到了 objc_exception_throw。我尝试了这两种方法,但都没有成功。
ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:url];
NSMutableDictionary *properties = [[NSMutableDictionary alloc] init];
[properties setValue:@".google.com" forKey:@"Domain"];
[properties setValue:@"/" forKey:@"path"];
[properties setValue:@"1600000000" forKey:@"expires"];
NSHTTPCookie *cookie = [[NSHTTPCookie alloc] initWithProperties:properties];
[request setRequestCookies:[NSMutableArray arrayWithObject:cookie]];
或用这个替换 cookie 的启动代码
NSHTTPCookie *cookie = [[NSHTTPCookie alloc] init];
当我注释掉以下行时,一切正常。
[request setRequestCookies:[NSMutableArray arrayWithObject:cookie]];
你们能告诉我这里有什么问题吗!