すでにRestkitでPOSTを使用しており、正常に動作しています。しかし、Restkit の POST と PUT の違いがわかりません。メソッドタイプを「PUT」のみに変更しました。しかし、私のパラメーターは Webservice に送信していません。
以下は私のコードです。POSTの同じコードが機能しています。
AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:URL];
[client setDefaultHeader:@"Authorization" value:[DSUserDefaults user].accessToken];
NSDictionary *prefDict=[NSDictionary dictionaryWithObjectsAndKeys: @"",@"COMPANY_ID" ,@"",@"JOBTITLE",@"2",@"JOBTYPE" ,@"San Franscisco, US",@"LOCATION", nil];
NSLog(@"prefDict %@",prefDict);
NSMutableURLRequest *request = [client requestWithMethod:PUT path:@"" parameters:prefDict];
[request setURL:URL];
[request setTimeoutInterval:60.0];
[request setHTTPMethod:PUT];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[AFHTTPRequestOperation addAcceptableStatusCodes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(100, 500)]];
[operation setCompletionBlockWithSuccess: ^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"operation.responseString: %@", operation.responseString);
NSData *data =[operation.responseString dataUsingEncoding:NSUTF8StringEncoding];
}
リクエストに「テキスト」データを送信する方法。辞書として送信する必要はありません。