2013-03-31 39 views
0

我不明白这个错误。iOS获取Prestashop Web服务的问题(kCFErrorDomainCFNetwork错误-1012。)

如果有人可以帮助我从这个无限的误区弄清楚,你可以使我睡得更好;)

我小心翼翼地跟着documentation和所有工作正常,直到我切换到iOS的项目。

http://[email protected]/prestashop/api/ 

enter image description here

从iOS的身边,我得到这个代码和错误:

enter image description here

NSString *requestString = [NSString stringWithFormat:@"http://%@@%@/prestashop/api/", self.session.key, @"192.168.1.112"]; 

    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:requestString]]; 

    [request setHTTPMethod:@"GET"]; 

    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *res, NSData *data, NSError *err){ 
     [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 

     NSLog(@"%@", err); 
     [self didReceiveData:data]; 
    }]; 

这里所有的代码是非常基本的,可能是太过分了? 我忘了1步从Web服务获取数据吗?

回答

1
NSString *requestString = [NSString stringWithFormat:@"http://%@:@%@/prestashop/api/", self.session.key, @"192.168.1.112"]; 

解决,它错过了 “:” :)

+1

嘿@Adrien。我也在iOS项目上工作,但我无法解决登录API处理,注册新客户和更新客户的问题。你能帮我解决吗?在这里看到我的问题 http://stackoverflow.com/questions/15924253/prestashop-create-customer – Swati

0

通过当我使用卷曲我得到的方式:

curl -X GET -u '263DE3VI7PY5KE6O6R84RACYYEH5S5GF:' 'http://192.168.1.112/prestashop/api/customers/' 
<?xml version="1.0" encoding="UTF-8"?> 
<prestashop xmlns:xlink="http://www.w3.org/1999/xlink"> 
<customers> 
<customer id="1" xlink:href="http://192.168.1.112/prestashop/api/customers/1"/> 
<customer id="2" xlink:href="http://192.168.1.112/prestashop/api/customers/2"/> 
</customers> 
</prestashop>