// 设置超时时间
[manager.requestSerializerwillChangeValueForKey:@"timeoutInterval"];
manager.requestSerializer.timeoutInterval =10.f;
[manager.requestSerializerdidChangeValueForKey:@"timeoutInterval"];
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[manager.requestSerializer setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
会引起AAFnetworking 在3G网络下强制60秒超时
无意中发现代码执行顺序调整后就正常了 找了半天没找到原因 以上代码在Wifi情况下是能保证10秒超时的 真奇葩,不懂原理啊
[manager.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[manager.requestSerializer setValue:@"application/json; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; //这两句会引起超时无效 删除就可以了
[manager.requestSerializer willChangeValueForKey:@"timeoutInterval"];
manager.requestSerializer.timeoutInterval = 10.f;
[manager.requestSerializer didChangeValueForKey:@"timeoutInterval"];