in my Iphone app i use AFNetworking to POST some data to a webservice and get some data back...
Here is my example, i always get "false" back as response, what i am doing wrong?
NSURL *baseURL = [NSURL URLWithString:@"http://myPath/Iphone/method"];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:baseURL];
[httpClient defaultValueForHeader:@"Accept"];
NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
[udid copy], @"uuid",
nil];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:@"http://myPath/Iphone/method" parameters:params];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[httpClient registerHTTPOperationClass:[AFXMLRequestOperation class]];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
response = [operation responseString];
NSLog(@"response: %@",response);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error: %@", [operation error]);
}];
[operation start];
EDIT: the method i call in the Url returns a string (no the string is not false)
[HttpPost]
public bool checkIphone(string uuid)
{
IDictionary<string,object> check = Request.Properties;
uuid = check["uuid"].ToString();
//do anything with the uuid
if (1<0)
{
return true;
}
else
{
return false;
}
}
this method i am calling with my iphone and normaly it should return xml or?