iPhone 应用程序在我打开地图时立即关闭

The iPhone app closes immediately when I open the map

由于未捕获的异常 'NSInvalidArgumentException',正在终止应用程序,原因:'-[__NSCFString objectForKey:]:无法识别的选择器发送到实例

完整描述

您需要在 ios/Runner/AppDelegate 上添加 google 映射 API 键。swift 文件

import UIKit
import Flutter
import GoogleMaps

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        GMSServices.provideAPIKey("GOOGLE_API_KEY")
        GeneratedPluginRegistrant.register(with: self)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
}