简体   繁体   English

为什么NSMutableURLRequest在iOS6和iOS7中的定义不同

[英]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: 我有以下一段代码可以在iOS6上完美运行,但不能在iOS7上运行,不同之处在于每个版本构造request1的方式,更改的原因以及可以使它们在两个版本上都可以工作的方法:

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 : 日志显示iOS6的以下内容:

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

And for iOS7 ( it Fails ): 对于iOS7(失败):

< 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? 我不认为我会遵循..您是否想知道为什么NSLog不相等?
Well ... they aren't implemented the same 好吧...它们的实现方式不同
the log merely calls the description method on it 日志仅在其上调用description方法

the definition of the class did not change though 该类的定义虽然没有改变

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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