一、下载AFNetworking.
二、将AFNetworking-master下的AFNetworking目录拖入到项目中
三、为项目添加Linking to a Library or Framework
CoreLocation.framework
SystemConfiguration.framework
Security.framework
MobileCoreServices.framework
四、修改项目.pch文件
1 #ifdef __OBJC__ 2 #import <UIKit/UIKit.h> 3 #import <Foundation/Foundation.h> 4 //添加AFNetworking包预编译头 5 #import <SystemConfiguration/SystemConfiguration.h> 6 #import <MobileCoreServices/MobileCoreServices.h> 7 #import "AFNetworking.h" 8 #endif
五、在相应的文件中加入引入
#import "AFNetworking.h"