NSUnderlyingError =“错误的网址”

时间:2012-09-22 19:26:12

标签: ios xcode nsurlconnection

我正在尝试使用以下方法从Google返回JSON:

NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com.br/maps/api/directions/json?origin=%@&destination=%@&sensor=false", pointOrigem, pointDestino];
    NSURL *url = [NSURL URLWithString:urlString]; 
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [NSURLConnection connectionWithRequest:request delegate:self];

    NSLog(@"%@", urlString);

正如您所看到的,我已经记录了网址,以确保一切正常。这是:

http://maps.google.com.br/maps/api/directions/json?origin=rua+cabral+983+Porto+Alegre+RS&destination=travessa+ouvidor+128+Porto+Alegre+RS&sensor=false

有人知道我的代码有什么问题吗? 谢谢你的帮助!

0 个答案:

没有答案