1
升級後取cookie來的Xcode 6,當我從登錄獲取餅乾「POST」行動,像這樣:爲什麼的iOS 8.0模擬器在Xcode 6.0.1不能正確
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@/login.php", kDSZHDomainString]];
ASIFormDataRequest *asirequest = [ASIFormDataRequest requestWithURL:url];
[asirequest setPostValue:username forKey:@"u"];
[asirequest setPostValue:password forKey:@"p"];
[asirequest setTag:kLoginRequest];
[asirequest setStringEncoding:-2147481083];
[asirequest setTimeOutSeconds:600];
[asirequest setDelegate:self];
[asirequest startAsynchronous];
當我設置斷點get請求的標題:
NSMutableDictionary * headers = [request requestHeaders];
調試信息:
Printing description of headers:
{
"Accept-Encoding" = gzip;
"Content-Length" = 20;
"Content-Type" = "application/x-www-form-urlencoded; charset=hz-gb-2312";
Cookie = "__utma=213790228.284667840.1411460847.1411460847.1411460847.1; __utmz=213790228.1411460847.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); o=m; s=542366a13a44e; sv[1]=12532852%2C12532147%2C12534523; v[11]=12515374; v[1]=12534523; v[2]=12521992; v[3]=12527199; v[9]=12441637";
"User-Agent" = "Top81 0.7 rv:0.7.459 (iPhone Simulator; iPhone OS 8.0; en_US)";
}
在iOS系統7模擬器,標題是:
Printing description of headers:
{
"Accept-Encoding" = gzip;
Cookie = "o=m; s=542369d4ede78; sv[1]=12532886%2C12528442%2C12534551; u=xxxx%2Ca999b1c0d3663e236f58277302b8be90%2C0; v[1]=12534551";
"User-Agent" = "Top81 0.7 rv:0.7.459 (iPhone Simulator; iPhone OS 7.1; en_US)";
}
所以,cookie「u」正確提取。
我用ASIHTTPRequest和AFNetworking測試代碼,並得到相同的結果。
它是Xcode和iOS 8模擬器的錯誤或任何代碼來解決這個問題?