【发布时间】:2015-03-20 07:36:35
【问题描述】:
我有以下网址:
http://beta.bemembr.com/en/webservice/abc123/members/login/email/******/password/****
还有这段代码:
NSString *path = [NSString stringWithFormat:@"en/webservice/%@/members/login/email/%@/password/%@",apiKey,login,pass];
NSLog(@"PATH IS %@",path);
[manager GET:path parameters:nil success:^(NSURLSessionDataTask *task, id responseObject)
{
NSDictionary *json = (NSDictionary *)responseObject;
NSLog(@"JSON IS %@",json);
int status = [[json valueForKey:@"status"] intValue];
if(status == 200){
compblock(YES);
}else{
compblock(NO);
}
}failure:^(NSURLSessionDataTask *task, NSError *error)
{
// Failure
NSLog(@"Failure: %@", error);
compblock(NO);
}];
这在 iPhone4 上有效,但在 iPhone 5、iPhone6 和 iPhone 6+ 上失败
这是我得到的错误:
Failure: Error Domain=NSURLErrorDomain Code=-1001 "The operation couldn’t be completed. (NSURLErrorDomain error -1001.)" UserInfo=0x7f8951c5c7b0 {NSErrorFailingURLStringKey=http://beta.bemembr.com/en/webservice/abc123/members/login/email/*****/password/*****, NSUnderlyingError=0x7f8951c82220 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1001.)", NSErrorFailingURLKey=http://beta.bemembr.com/en/webservice/abc123/members/login/email/*****/password/*****}
谁能帮帮我?
谢谢!
【问题讨论】:
-
iPhone 4运行的是什么iOS版本,你的其他设备运行的是什么iOS版本?我遇到了一些问题,iOS 8 现在对网络请求比以前的版本更“挑剔”(有关可能性,请参阅下面的答案)。
标签: ios objective-c iphone afnetworking nsurlrequest