swift - Flutter google Maps ios构建失败
问题描述
我正在尝试在我的颤振应用程序中实现谷歌地图。我正在使用这个版本:
google_maps_flutter: ^0.5.21+15
它适用于android,但在ios上尝试时构建失败。
我发现了这个:
通常我的 AppDelegate.swift 看起来像这样:
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
但是当我使用它时,正如谷歌地图插件所说,构建失败:
import UIKit
import Flutter
import GoogleMaps
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("YOUR KEY HERE")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
我究竟做错了什么?
感谢您的帮助!
以防万一,这是我的 pubspec yaml
cupertino_icons: ^0.1.2
firebase_core: ^0.4.3+1
firebase_auth: ^0.15.2
cloud_firestore: ^0.13.0+1
firebase_database: ^3.1.1
cloud_functions: ^0.4.1+6
firebase_messaging: ^6.0.9
firebase_storage: ^3.1.0
google_sign_in: ^4.1.0
flutter_facebook_login: ^3.0.0
geolocator: ^5.1.5
shared_preferences: ^0.5.6
url_launcher: ^5.4.1
rflutter_alert: ^1.0.3
font_awesome_flutter: ^8.5.0
flutter_picker: ^1.1.0
uuid: ^2.0.4
image_picker: ^0.6.2+3
path_provider: ^1.5.1
image: ^2.1.4
flutter_datetime_picker: ^1.2.8
intl: ^0.16.0
native_contact_picker: ^0.0.6
flutter_spinkit: ^4.1.1+1
transparent_image: ^1.0.0
connectivity: ^0.4.6+1
flare_splash_screen: ^3.0.0
algolia: ^0.1.7
http: ^0.12.0+2
avatar_glow: ^1.1.0
rxdart: ^0.22.2
auto_size_text: ^2.1.0
camera: ^0.5.7+2
video_player: ^0.10.5
story_view: ^0.11.0
image_crop: ^0.3.1
file_picker: ^1.4.3+1
pdf_viewer_plugin: ^1.0.0+2
flutter_background_geolocation: ^1.4.5
location_permissions: ^2.0.3
image_downloader: ^0.19.1
permission_handler: ^4.0.0
google_maps_flutter: ^0.5.21+15
这是我得到的错误:
/Users/kareldebedts/myapp/ios/Runner/AppDelegate.swift:7:17: error: method does not override any method from its superclass
override func application(
~~~~~~~~ ^
note: Using new build system
note: Planning build
note: Constructing build description
warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'image_picker' from project 'Pods')
warning: Mapping architecture armv7 to i386. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'camera' from project 'Pods')
warning: Mapping architecture arm64 to x86_64. Ensure that this target's Architectures and Valid Architectures build settings are configured correctly for the iOS Simulator platform. (in target 'camera' from project 'Pods')
Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.
解决方案
您已在函数签名中替换UIApplication.LaunchOptionsKey
为。UIApplicationLaunchOptionsKey
将其替换回去以修复错误
推荐阅读
- python - 游戏“乒乓”我的代码有问题
- javascript - 根据下拉选择检索数据
- sql - 基于另一个表的可选 Where 子句
- apache-spark - Pyspark 按条件分组和计数数据
- docker - ModuleNotFoundError:没有使用 Docker 的名为“psycopg2”的模块
- moodle - 创建自定义品牌moodle应用程序的过程是什么?
- f# - 如何在 F# 中同时等待取消令牌和 EventWaitHandle?
- php - 命令在第一个 php 打开标记的正下方和多个文件中插入一行代码
- sql - 签入 oracle 以订购
- symfony - 如何提高 SwiftMailer DKIM Signer 的性能?