小编Abd*_*jao的帖子

请问如何在 flutter 桌面中使用谷歌地图?

我到处搜索有关如何将谷歌地图包含在 flutter 桌面应用程序中的指南。我尝试按照 iOS 指南进行操作,但没有成功。macos/Runner我在目录中的 AppDelegate.swift 中做了以下操作

import Cocoa
import FlutterMacOS
import GoogleMaps

@NSApplicationMain
class AppDelegate: FlutterAppDelegate {
  override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
    GMSServices.provideAPIKey("MY_API_KEY")
    return true
  }
}
Run Code Online (Sandbox Code Playgroud)

但我总是收到以下错误

The following build commands failed:
    CompileSwift normal x86_64 /Users/xxxxx/xxxxx/xxxxxx/xxxxx/macos/Runner/AppDelegate.swift
    CompileSwift normal x86_64 /Users/xxxxxxx/xxxxxx/xxxxxx/xxxxxx/macos/Flutter/GeneratedPluginRegistrant.swift
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(3 failures)
Finished with error: Build process failed
Run Code Online (Sandbox Code Playgroud)

macos google-maps desktop-application flutter

7
推荐指数
1
解决办法
4553
查看次数

标签 统计

desktop-application ×1

flutter ×1

google-maps ×1

macos ×1