2
我試圖解析JSON,並得到一個SIGABRT錯誤:reason: '[<NSURLRequest 0x7e7e970> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key Content-Type.
的Content-Type JSON SIGABRT錯誤
我的代碼是:
self.responseData = [NSMutableData data];
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://dmsfw01.dev.com:8082/G.FQI/GVOLFQI.svc/Search(v)?Start=1&Count=10"]];
NSString *contentType = @"application/json";
[request setValue:contentType forKey:@"Content-Type"];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
我應該怎麼做,而不是設置內容類型?
...還有,使用'setValue:forHTTPHeaderField'方法,而不是'setValue:forKey' – lxt 2013-02-13 19:40:22