gpt4 book ai didi

ios - 带有 URL Scheme 的谷歌地图?

转载 作者:行者123 更新时间:2023-11-29 12:09:43 29 4
gpt4 key购买 nike

我正在尝试使用谷歌地图获取方向。我正在关注此链接 https://developers.google.com/maps/documentation/ios-sdk/urlscheme?hl=en

和代码:

if ([[UIApplication sharedApplication] canOpenURL:
[NSURL URLWithString:@"comgooglemaps://"]]) {
NSString *temp=@"comgooglemaps://?saddr=Google+Inc,+8th+Avenue,+New+York,+NY&daddr=John+F.+Kennedy+International+Airport,+Van+Wyck+Expressway,+Jamaica,+New+York&directionsmode=transit";

[[UIApplication sharedApplication] openURL:
[NSURL URLWithString:temp]];
} else {
NSLog(@"Can't use comgooglemaps://");
}

map 没有打开,我得到:

Installation[2918:1295695] -canOpenURL: failed for URL: "comgooglemaps://" - error: "(null)"

问题是什么?我错过了什么吗?

我想在我的应用程序中显示谷歌地图。

最佳答案

In iOS 9 you must whitelist any URL schemes your App wants to query in Info.plist under the LSApplicationQueriesSchemes key (an array of strings):

enter image description here

引自此处http://useyourloaf.com/blog/querying-url-schemes-with-canopenurl.html

关于ios - 带有 URL Scheme 的谷歌地图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33821692/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com