在flutter上打开苹果地图会给出无效的URL方案



在flutter代码中打开映射是这样的。它正在谷歌上工作,但没有推出苹果地图网址。可能是小错误或遗漏了什么

String addrs = '';
addrs = '###';
String googleUrl =
'comgooglemaps://?q=${Uri.encodeComponent(addrs)}&center=lat,lng';
String appleUrl =
'https://maps.apple.com/?q=${addrs}&sll=lat,lng';
if (await canLaunch("comgooglemaps://")) {
print('launching com googleUrl');
await launch(googleUrl);
} else if (await canLaunch(appleUrl)) {
print('launching apple url');
await launch(appleUrl);
} else {
print('Could not launch url');
}```

请像对谷歌地图一样对苹果地图的URL进行编码。

相关内容

最新更新