【问题标题】:Flutter google Maps ios build failFlutter google Maps ios构建失败
【发布时间】:2020-04-09 10:28:00
【问题描述】:

我正在尝试在我的颤振应用中实现谷歌地图。 我正在使用这个版本:

  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.

【问题讨论】:

    标签: swift xcode macos flutter dart


    【解决方案1】:

    您已在函数签名中将 UIApplication.LaunchOptionsKey 替换为 UIApplicationLaunchOptionsKey。将其替换回去以修复错误

    【讨论】:

    • 仅供参考,您可以使用一些差异工具来查找两个代码 sn-ps 中不同的所有地方
    • 谢谢!很奇怪,因为我从官方谷歌地图包中获得了sn-p。但它有效!谢谢!
    猜你喜欢
    • 2020-12-28
    • 2020-08-18
    • 2021-09-13
    • 2020-09-15
    • 2020-12-07
    • 2020-06-04
    • 1970-01-01
    • 2020-08-25
    • 2020-03-16
    相关资源
    最近更新 更多