在flutter中打开 map 的代码是这样的。它在谷歌上工作但没有启动苹果 map url。可能是小错误或遗漏了什么
String addrs = '';
addrs = '###';
String googleUrl =
'comgooglemaps://?q=${Uri.encodeComponent(addrs)}¢er=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');
}```
最佳答案
请像对谷歌地图一样对苹果 map 的 URL 进行编码。
关于flutter - 在 flutter 上打开 Apple map 会给出无效的 URL 方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70936920/