AFNetWorking和ASIHTTPRequest的比較

 

1 將AFNetWorking文件夾導入項目javascript

2 添加類庫 Security.framework、MobileCoreServices.framework、SystemConfiguration.frameworkhtml

3 在使用的地方 #import "AFNetworking.h"java

解決編譯時警告:json

  1. Prefix.pch文件中加入  
  2. #import <SystemConfiguration/SystemConfiguration.h>  
  3. #import <MobileCoreServices/MobileCoreServices.h>  

注:AFNetWorking使用了ARC ,在不使用ARC項目中使用時,對AFNetWorking的全部.m文件添加「-fobjc-arc」 app

  在使用ARC項目中,使用「不使用ARC」的類庫時,對類庫的.m文件添加「-fno-objc-arc」post

 

 

 

 

 

AFNetWorking出現code=-1016錯誤解決辦法spa

AFNetWorking的JSON解析默認庫是使用的AFJSONRequestOperation模式,只支持text/json,application/json,text/javascript,因此若是出現code=-1016錯誤則說明當前的JSON解析模式是text/html,因此要加上這段代碼:code

[AFJSONRequestOperation addAcceptableContentTypes:[NSSet setWithObject:@"text/html"]];

讓他支持text/html模式就能夠解決了
xml

相關文章
相關標籤/搜索