他のすべてを試した後、この行はうまくいきました:
operation.responseSerializer = [AFCompoundResponseSerializer シリアライザー];
NSString *strdata =[NSString stringWithFormat:@"{\"objID\":\"%ld\",\"objString\":\"%@\",\"objWidth\":\"%@\",\"objHeight\":\"%@\",\"objStartX\":\"%@\",\"objStartY\":\"%@\",\"objEndX\":\"%@\",\"objEndY\":\"%@\",\"objSnapX\":\"%@\",\"objSnapY\":\"%@\",\"objImage\":\"%@\"}",
(long)self.accelerometerObject.objID,
self.accelerometerObject.objString.string,
self.accelerometerObject.objWidth,
self.accelerometerObject.objHeight,
self.accelerometerObject.objStartX,
self.accelerometerObject.objStartY,
self.accelerometerObject.objEndX,
self.accelerometerObject.objEndY,
self.accelerometerObject.objSnapX,
self.accelerometerObject.objSnapY,
self.accelerometerObject.objImage];
NSLog(@"%@",strdata);
NSDictionary *parameters = @{
@"data" : strdata,
};
AFHTTPRequestOperationManager *requestOperationManager = [AFHTTPRequestOperationManager manager];
requestOperationManager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
NSString *requestURL = @"http://yourserver.com/dataHandler.asmx/scriptToHandlePost";
requestOperationManager.responseSerializer = [AFCompoundResponseSerializer serializer];
requestOperationManager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
[requestOperationManager POST:requestURL
parameters:parameters
success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"Succeeded: >>>>>>> %@",strdata);
}
failure:^(AFHTTPRequestOperation *operation, NSError *error)
{
NSLog(@">>>>>>>>>>>failed %@",error);
}];