0

I Have the following piece of Code that works perfectly fine in iOS6 but not in iOS7, the difference is how the request1 is constructed by each version, why it changes and what can be done to make it work on both:

NSMutableURLRequest *request1 = [NSMutableURLRequest requestWithURL:url];

[request1 setHTTPMethod:@"POST"];
[request1 setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request1 setHTTPBody:[jsonInputString dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@" %@",request1);

And the log shows the following for iOS6 :

< NSMutableURLRequest http://XX.XX.XX.XX/ServiceFindMyFamily.svc/GPS/PosicionPorIDDispositivo/>

And for iOS7 ( it Fails ):

< NSMutableURLRequest: 0x16d8a020> { URL: http://XX.XX.XX.XX/ServiceFindMyFamily.svc/GPS/PosicionPorIDDispositivo/ }

Thanks for your kindly help

Jonathan.
  • 53,997
  • 54
  • 186
  • 290
  • request, not connection :) – Daij-Djan Feb 03 '14 at 18:20
  • 6
    When you print an object through NSLog, what is really printed is the result of the "description" property ( [request1 description] ). This is not an indication that the two connection object are different, but only that in iOS 7 Apple decided to print more detail inside the description method...You have to search your problem elsewhere – LombaX Feb 03 '14 at 18:22
  • What fails exactly? The NSURLConnection? What error do you get? – Martin R Feb 03 '14 at 18:28
  • Actually i dont know exactly what fails.The only behavior i see is that with the same parameters the request works on iOS6 ( The ns Connection returns data ) and in iOS7 it does not. Im assumming the problem is on the request itself because ive tried the the service directly with the parameters and it works. – Guillermo Feb 03 '14 at 22:27

1 Answers1

0

I don't think I follow.. do you wonder why the NSLog isn't equal?
Well ... they aren't implemented the same
the log merely calls the description method on it

the definition of the class did not change though

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135