【发布时间】:2020-04-01 21:17:32
【问题描述】:
几天前推出的谷歌地图和苹果地图都很好。我在主通道上将 Flutter 更新到其最新版本到 1.13.1。我假设更新后它停止工作。所以我将频道更改为测试版并尝试过,但仍然无法正常工作。尝试启动 Google Maps 或 Apple Maps 时,IOS 应用程序崩溃,我既不理解错误,也没有在互联网上找到任何东西。
非常感谢任何帮助。
我的用户界面代码:
ListTile(
title: Text("Launch Google Maps", textAlign: TextAlign.center),
onTap: () async {
final String clubName =
clubs[index].name.toString().replaceAll(" ", "+");
print("Name: $clubName"); // 'Flawless+Club'
final String clubCity = clubs[index].stadt;
print("Name: $clubCity"); // 'London'
final String newGoogleUrl =
"https://www.google.com/maps/dir/?api=1&destination=$clubName+$clubCity";
if (await canLaunch(newGoogleUrl)) {
await launch(newGoogleUrl);
} else {
throw 'Could not launch $newGoogleUrl';
}
},
),
Flutter Doctor -v 输出:
[✓] Flutter (Channel beta, v1.12.13+hotfix.3, on Mac OS X 10.15.1 19B88, locale en-DE)
• Flutter version 1.12.13+hotfix.3 at /Library/Flutter
• Framework revision 57f2df76d7 (2 days ago), 2019-12-05 21:23:21 -0800
• Engine revision ac9391978e
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/murat/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.2.1, Build version 11B500
• CocoaPods version 1.8.4
[✓] Android Studio (version 3.4)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 35.3.1
• Dart plugin version 183.6270
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[✓] VS Code (version 1.40.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.7.0
[✓] Connected device (1 available)
• No issues found!
点击 ListTile 时出错:
Lost connection to device.
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23c4f02e __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff50b97b20 objc_exception_throw + 48
2 Foundation 0x00007fff2578c55b -[__NSConcreteURLComponents initWithString:] + 0
3 CoreServices 0x00007fff24e970bd -[_LSURLOverride initWithOriginalURL:checkingForAvailableApplications:newsOnly:] + 151
4 CoreServices 0x00007fff24e97992 -[_LSURLOverride initWithOriginalURL:newsOnly:] + 25
5 CoreServices 0x00007fff24e982ae _ZN14LaunchServices12URLOverridesL20getURLOverrideCommonEP5NSURLb + 399
6 CoreServices 0x00007fff24e9810e -[LSApplicationWorkspace(LSURLOverride) URLOverrideForURL:] + 14
7 UIKitCore<…>
Exited (sigterm)
【问题讨论】:
-
尝试使用稳定通道,然后运行
flutter clean。 -
我不能使用stable频道,因为我至少需要使用Dart SDK 2.6.0版本。我有一些依赖项需要 Dart SDK 版本。
-
您好,感谢您发布此问题。我抛出了同样的错误,但不是针对谷歌地图,而是针对电话号码。 canLaunch 和 launch 函数的电话号码格式不正确。它也只会在IOS上抛出错误
-
是的,不幸的是,错误代码并没有真正的帮助。调试每个值有助于弄清楚这一点。
标签: google-maps url flutter dart crash