【问题标题】:Opening Maps App with Current Location & Directions in iOS 5在 iOS 5 中使用当前位置和方向打开地图应用程序
【发布时间】:2012-06-12 05:15:40
【问题描述】:

您好,我尝试使用它打开具有当前位置的地图应用程序,并获取到我为方向输入的任何内容的方向。当我单击 iPhone 上的按钮时,没有任何反应,但它被单击了。我做错了什么?

NSString *url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=Current+Location&daddr=%@ %@ %@ %@",
                     streetString , cityString, stateString, zipString];
    [[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];

【问题讨论】:

标签: google-maps ios5 ios4 core-location


【解决方案1】:

确保您正在使用 stringByAddingPercentEscapesUsingEncoding 转义 NSString

NSString *url = [NSString stringWithFormat: @"http://maps.google.com/mapssaddr=Current+Location&daddr=%@ %@ %@ %@", streetString , cityString, stateString, zipString];
url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-08-09
    • 2011-10-07
    • 2014-08-07
    • 2014-03-25
    • 1970-01-01
    • 2011-06-03
    • 2014-07-12
    相关资源
    最近更新 更多