0
我有下面的代碼使用一個相當古老的庫稱爲ASIHTTPRequest。我期待升級圖書館,但需要一些幫助,以確保我正確地做到這一點,並讓我的腳溼潤。這是我需要轉換爲AFNetworking的代碼。任何提示或建議表示讚賞。AFNetworking:如何將此標頭請求轉換爲使用AFNetworking?
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:urlStr]];
[request setDelegate:self];
NSMutableDictionary *userinfo = [[NSMutableDictionary alloc] init];
[userinfo setObject:NSStringFromSelector(self.didFinishSelector) forKey:@"didFinishSelector"];
[userinfo setObject:NSStringFromSelector(self.didFailSelector) forKey:@"didFailSelector"];
[request setUserInfo:userinfo];
[request setUserAgentString:USER_AGENT];
[request setTimeOutSeconds:60];
[request addRequestHeader:@"apiKey" value:apiKey];
[request setRequestMethod:method];
你需要用'AFNetworking'來做'POST'嗎? – iphonic 2014-09-06 18:15:05
是的,我需要做POST。 – user3606054 2014-09-06 18:19:12