简体   繁体   中英

AFNetworking From Post Request Not Working With IOS 5.1

i made a lot of search and i was not able to find solution for my problem,

i was trying to make an form post request with json data using afnetworing library , everything works fine in ios 6 .

when i tested it in ios 5.1 version , form post request is not triggered , or something wrong is happening

Below is my request will look like:

        id paramString;
        if(![data isKindOfClass:[NSString class]])
        paramString = [Helper objectToJsonString:data AND:0]; // converts nsdictionary to        string
        else
            paramString = data;

        NSLog(@"Param String => %@ \n",paramString);

        AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL     URLWithString:urlString]];
        [httpClient setParameterEncoding:AFFormURLParameterEncoding];

        NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:nil parameters:paramString];
        [request setCachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData];
        [request setTimeoutInterval:30];

        [self makeJsonRequest:requestedView withSelector:callBackFunction AND:request];

     AFJSONRequestOperation *operation = [[AFJSONRequestOperation alloc]     initWithRequest:request];
            [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation,     id responseObject) {
 NSLog(@" response data => %@",json);
    }

      failure:^(AFHTTPRequestOperation *operation, NSError *error) {
     NSLog(@" error=> %@",error);
}];

for ios 6, following is my response : Json Response => { Details = "process created!"; Response = Success; }

but for ios 5 , my response looks like Json Response => { }

if its not an valid form post request or request body doesn't contain anything means our server will return emtpy response

POINT TO NOTE : Everything works fine with ios 6

am i using any function related to ios 6 in this code

can anyone help me fix this issue!

Thanks in Advance!!!

您好,我本人发现了问题,实际上是NSUUID问题,它是ios 6的功能,我试图在ios 5中使用它,所以为null,因为在我们的服务中找不到必需的参数,因此我收到了{}作为响应。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM