0
通常情況下,下載一個JSON,我用AFNetworking創建一個單獨與此代碼如何將一些參數添加到JSON請求?
- (void)getJSON {
NSURLRequest * request =
[NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://URL"]];
AFJSONRequestOperation * operation =
[AFJSONRequestOperation JSONRequestOperationWithRequest:request
success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
NSArray * js = JSON;
[_delegate dati:js];
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * filePath = [[paths lastObject] stringByAppendingPathComponent:@"downloaded.json"];
NSData * data = [NSJSONSerialization dataWithJSONObject:JSON
options:NSJSONWritingPrettyPrinted
error:NULL];
[data writeToFile:filePath
atomically:YES];
}];
[operation start];
}
,並查看調用此代碼控制器
[[DataManager sharedClass] getJSON];
和它的作品,但現在我需要發送(發佈)一些參數(作爲授權代碼,GPS座標,用戶郵件或類似的東西)到服務器的請求中以接收特定的JSON。服務器已經配置好,並且工作正常,但是我找不到修改我的代碼的指南。有人知道如何繼續?