一开始老是访问不了,由于是内网服务器我们得配置下hosts文件,然后用模拟器运行程序。这样才能访问到真实的ip,
或者直接访问ip进行接口测试。
待更新宕机判断条件
- (void)getDataFaile:(AFHTTPRequestOperation *)operation {
if (operation.responseData != nil) {
//服务器维护vc
}
新的判断方式
NSInteger httpCode = ((NSHTTPURLResponse *)task.response).statusCode;
BOOL isDisplayServerMaintenancePage = (httpCode >= 500 ||
httpCode == 404 ||
[error.localizedDescription isEqualToString:@"Request failed: not found (404)"]);