「报错1」打印为:NSLocalizedDescription=Request failed: unacceptable content-type: text/html
- 问题描述:
- 发送请求后,返回来的JSON数据报错;
- 之前请求没问题,更新了af以后出现的这个问题,
- 解决方法:
是因为新的af里面没有这种服务器返回的数据格式类型,所以需要在AFNetworking里面找到AFURLResponseSerialization.m文件,在228行里面添加下面的蓝色内容:
self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/html",@"text/json", @"text/javascript", nil];
「报错2」打印为:“App TransportSecurity has blocked a cleartext HTTP (http://) resource load since it isinsecure. Temporary exceptions can be configured via your app's Info.plistfile.”
- 问题描述:发送网络请求报错
- 解决方法:
简而言之:ATS禁止了HTTP的明文传输,因为它不安全。可以修改Info.plist文件,让它临时允许明文传输。
解决办法:
在Info.plist文件中添加"App Transport SecuritySettings", Type为"Dictionary",再添加"Allow Arbitray Loads", Type 为"Boolean",“Value”为“YES”即可
「报错3」打印为:[env: ruby_executable_hooks: No such file or directory的解决办法](http://blog.csdn.net/qq_29284809/article/details/52495698)
- 问题描述:
- 解决方法:
- 解决办法打开我们的终端,执行which ruby_executable_hooks 或者 which gem 或者 which pod;
xiaqiangdeMacBook-Pro:~ xiaqiang$ which gem/Users/xiaqiang/.rvm/rubies/ruby-2.2.2/bin/gemxiaqiangdeMacBook-Pro:~ xiaqiang$ which ruby_executable_hooks/Users/xiaqiang/.rvm/gems/ruby-2.2.2@global/bin/ruby_executable_hooksxiaqiangdeMacBook-Pro:~ xiaqiang$ which pod/usr/local/bin/pod
将前面的路径,截取到它所在的目录,如:/usr/local/bin 或
者/Users/xiaqiang/.rvm/gems/ruby-2.2.2@global/bin 或
者/Users/xiaqiang/.rvm/rubies/ruby-2.2.2/bin,粘贴到Xcode -> Product ->CocoaPods ->GEM_PATH里面,按下回车键;再次执行Xcode -> Product ->CocoaPods ->Install Pods命令,即可安装第三方库;
「报错4」打印为:
- 问题描述:
- 解决方法: