iOS 网络请求--- 配置info.plist文件

一、配置info.plist

  <key>NSAppTransportSecurity</key>
  <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
  </dict>

以上代码添加在info.plist文件倒数第三行处 (右击info.plist -> Open As ->Source Code),如下图:

如果使用AFNetworking出现以下错误

在AFURLResponseSerialization.m文件中添加 self.acceptableContentTypes = [NSSetsetWithObjects:@"application/json", @"text/html",@"text/json",@"text/javascript", nil];红色部分

原文地址:https://www.cnblogs.com/xsphehe/p/5777788.html