RestKitを使用して同期リクエストを行うにはどうすればよいですか?
私は以前このように使用しました(SBJSON):
UIDevice *myDevice = [UIDevice currentDevice];
NSString *deviceUDID = [myDevice uniqueIdentifier];
double v = [[[UIDevice currentDevice] systemVersion]doubleValue];
NSString *version=[NSString stringWithFormat:@"%@ %.1f",deviceType,v];
NSString *encodedParam1 =[version stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString *requestString = [NSString stringWithFormat:@"method=views.get&view_name=client_list",nil];
NSData *requestData = [NSData dataWithBytes: [requestString UTF8String] length: [requestString length]];
NSString *urlString = [NSString stringWithFormat:@"http://localhost/index.php?oper=StoreDeviceId&device_id=%@&device_version=%@",deviceUDID,encodedParam1];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod: @"POST"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody: requestData];
//Data returned by WebService
NSData *returnData = [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil ];
[request release];
NSString *returnString = [[NSString alloc] initWithData:returnData encoding: NSUTF8StringEncoding];
NSDictionary *dict1 = [returnString JSONValue];
同じ操作で、restkitフレームワークを使用して処理する方法。
事前の感謝