AFNetWoking header 认证

2019-11-29  本文已影响0人  天序C

AFHTTPSessionManager *manager=[[AFHTTPSessionManager alloc]init];
[manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type”]; //设置与后台服务器一致的请求类型
// 下面注释的 也是设置请求类型json
//manager.requestSerializer = [AFJSONRequestSerializer serializer];
// [manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Content-Type”];
[manager.requestSerializer setValue:@"ios9.0" forHTTPHeaderField:@"sysVersion”]; // 填写系统版本
[manager.requestSerializer setValue:@"x86_64" forHTTPHeaderField:@"deviceModel”]; // 填写设备
[manager.requestSerializer setValue:@"1.0" forHTTPHeaderField:@"appVersion”]; //填写app版本
[manager.requestSerializer setValue:@“token数据" forHTTPHeaderField:@"Authorization"];

上一篇下一篇

猜你喜欢

热点阅读