AFNetworking 問題

来源:互联网 发布:办公室office软件下载 编辑:程序博客网 时间:2024/06/06 00:16

在新的AFNetworking 3.0 中移除 AFHTTPRequestOperationManager 其方法架載到AFHTTPSessionManager 使用

AFHTTPSessionManager *manger = [AFHTTPSessionManager manager]來創建manager 。參見 https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide 

令,Xcode 7.0 以上不能直接用HTTP訪問內入。需要在info.list 中添加 「App Transport Security Settings」屬性為字典。在其中添加項目「Allow Arbitrary Load」七數學為Boolean 值為YES。 若獲區的JSON數據是 「@"text/html」則需要在 「AFURLResponseSerialization.m」大約在226行方法為「

 self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/html", @"text/javascript", nil 」添加@“text/html“。

0 0
原创粉丝点击