【问题标题】:How to add Google Maps to a flutter module that is used inside a native iOS app如何将 Google 地图添加到原生 iOS 应用程序中使用的颤振模块
【发布时间】:2021-10-02 11:07:40
【问题描述】:

我有一个原生 iOS 应用程序,它为一些功能集成了一个颤振模块。 现在对于一个新功能,我需要在颤振模块中集成谷歌地图。

文档说我们需要在 ios/Runner/AppDelegate.m 中添加 Google 地图初始化代码,但在我的情况下,整个 .iOS 文件夹会在每个新版本中重新生成,并且只有在我运行颤振时添加东西才能使它工作模块独立。但是当我将flutter模块与iOS原生应用程序集成时,我会崩溃:Google Maps SDK for iOS must be initialized via [GMSServices provideAPIKey:...] prior to use即使我在原生iOS AppDelegate中有这行。

我错过了什么?

【问题讨论】:

    标签: ios flutter google-maps flutter-module


    【解决方案1】:

    想出了如何通过初始化 Flutter 模块中使用的谷歌地图库以及主应用程序中使用的谷歌地图库来解决这个问题:

    因此,在我的代码中,我必须在 Flutter 模块中添加一个 Google Maps 初始化方法,并在原始 Google Maps 初始化程序之后从主应用程序中的 appDelegate 调用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-09-23
      • 2021-06-20
      • 1970-01-01
      • 2019-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多