首页 > 代码库 > iOS开发遇到的那些bug

iOS开发遇到的那些bug

1.创建新项目用到 进行网络请求请求时,报下面的错: 
“App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app’s Info.plist file”

解决办法:

1、在Info.plist中添加 NSAppTransportSecurity 类型 Dictionary ;

2、在 NSAppTransportSecurity 下添加 NSAllowsArbitraryLoads 类型Boolean ,值设为 YES;

 

2.使用AFNetworking 3.0+版本进行网络请求,报如下错误:

Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x60000002db00>

解决办法:

  AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];

  manager.responseSerializer = [AFHTTPResponseSerializer new];

  manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];

 

持续更新...

 

 

iOS开发遇到的那些bug