-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[google_maps_flutter] Plugin Crashes Without a Helpful Error message on iOS If No API Key Specified #17894
Comments
For me, the maps demo on iOS didn't work even when I had the API key added in the Solution:
You can then delete the following line from |
i also have same issue but now its fix please check your AppDelegate.swift
|
If we omit the API key, the app fatally crashes without a helpful error message Flutter logs
Xcode logslogs2021-04-20 15:55:25.036888+0300 Runner[32042:361933] Metal GPU Frame Capture Enabled
2021-04-20 15:55:25.037847+0300 Runner[32042:361933] Metal API Validation Enabled
2021-04-20 15:55:25.197789+0300 Runner[32042:362420] flutter: Observatory listening on http://127.0.0.1:63106/A1ZZV6nU1tc=/
2021-04-20 15:55:26.057039+0300 Runner[32042:361933] *** Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20421af6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204219d4 -[NSException initWithCoder:] + 0
3 Runner 0x000000010c7577d6 +[GMSServices checkServicePreconditions] + 245
4 Runner 0x000000010c75496f +[GMSServices sharedServicesSync] + 110
5 Runner 0x000000010c740cbb -[GMSMapView initWithFrame:camera:] + 59
6 Runner 0x000000010c740be2 +[GMSMapView mapWithFrame:camera:] + 90
7 Runner 0x000000010cb9e602 -[FLTGoogleMapController initWithFrame:viewIdentifier:arguments:registrar:] + 354
8 Runner 0x000000010cb9e44d -[FLTGoogleMapFactory createWithFrame:viewIdentifier:arguments:] + 141
9 Flutter 0x000000010d6d6f1c _ZN7flutter30FlutterPlatformViewsController8OnCreateEP17FlutterMethodCallRU13block_pointerFvP11objc_objectE + 488
10 Flutter 0x000000010d6d0598 __47-[FlutterEngine maybeSetupPlatformViewChannels]_block_invoke.165 + 120
11 Flutter 0x000000010da76316 __45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104
12 Flutter 0x000000010d6f561c _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 166
13 Flutter 0x000000010d6fa7fe _ZN7flutter15PlatformViewIOS21HandlePlatformMessageEN3fml6RefPtrINS_15PlatformMessageEEE + 38
14 Flutter 0x000000010daa10c3 _ZNSt3__110__function6__funcIZN7flutter5Shell29OnEngineHandlePlatformMessageEN3fml6RefPtrINS2_15PlatformMessageEEEE4$_38NS_9allocatorIS8_EEFvvEEclEv + 83
15 Flutter 0x000000010da1f084 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 160
16 Flutter 0x000000010da2423c _ZN3fml17MessageLoopDarwin11OnTimerFireEP16__CFRunLoopTimerPS0_ + 26
17 CoreFoundation 0x00007fff20390c57 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
18 CoreFoundation 0x00007fff2039072a __CFRunLoopDoTimer + 926
19 CoreFoundation 0x00007fff2038fcdd __CFRunLoopDoTimers + 265
20 CoreFoundation 0x00007fff2038a35e __CFRunLoopRun + 1949
21 CoreFoundation 0x00007fff203896d6 CFRunLoopRunSpecific + 567
22 GraphicsServices 0x00007fff2c257db3 GSEventRunModal + 139
23 UIKitCore 0x00007fff24696cf7 -[UIApplication _run] + 912
24 UIKitCore 0x00007fff2469bba8 UIApplicationMain + 101
25 Runner 0x000000010c730ecb main + 75
26 libdyld.dylib 0x00007fff2025a3e9 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'GMSServicesException', reason: 'Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use'
terminating with uncaught exception of type NSException
CoreSimulator 732.18.6 - Device: iPhone 12 (83060656-28E7-44CD-801E-B11EC3EC89BA) - Runtime: iOS 14.4 (18D46) - DeviceType: iPhone 12
(lldb) flutter doctor -v[✓] Flutter (Channel stable, 2.0.5, on macOS 11.2.3 20D91 darwin-x64, locale
en-GB)
• Flutter version 2.0.5 at /Users/tahatesser/Code/flutter_stable
• Framework revision adc687823a (4 days ago), 2021-04-16 09:40:20 -0700
• Engine revision b09f014e96
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Volumes/Extreme/SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Volumes/Extreme/SDK
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.55.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.21.0
[✓] Connected device (3 available)
• iPhone 12 (mobile) • 83060656-28E7-44CD-801E-B11EC3EC89BA • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 11.2.3 20D91 darwin-x64
• Chrome (web) • chrome • web-javascript
• Google Chrome 89.0.4389.128
• No issues found! [✓] Flutter (Channel master, 2.2.0-11.0.pre.176, on macOS 11.2.3 20D91
darwin-x64, locale en-GB)
• Flutter version 2.2.0-11.0.pre.176 at
/Users/tahatesser/Code/flutter_master
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cceeaa075 (7 hours ago), 2021-04-20 02:24:02 -0400
• Engine revision 7f4d7c67a5
• Dart version 2.14.0 (build 2.14.0-8.0.dev)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Volumes/Extreme/SDK
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = /Volumes/Extreme/SDK
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[!] IntelliJ IDEA Community Edition (version unknown)
✗ Invalid IntelliJ version number.
[✓] VS Code (version 1.55.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.21.0
[✓] Connected device (3 available)
• iPhone 12 (mobile) • 83060656-28E7-44CD-801E-B11EC3EC89BA • ios
• com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• macOS (desktop) • macos • darwin-x64
• macOS 11.2.3 20D91 darwin-x64
• Chrome (web) • chrome • web-javascript
• Google Chrome 89.0.4389.128
! Doctor found issues in 1 category. |
Similar to #22536. |
https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
If you don't include the API key in an iOS app the google_maps_flutter plugin will crash hard with the following with no indication as to why:
Only if you run "flutter run -v" will you get the actual reason:
It seems kind of harsh. If possible it would be nice to display a console message at the minimum.
The text was updated successfully, but these errors were encountered: