2013-03-31 48 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>