简体   繁体   中英

Why NSMutableURLRequest gets defined different in iOS6 and iOS7

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

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

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