颤振错误:没有这样的模块'GoogleMaps'



我在一个客户购买的项目中工作。该项目是Fluxstore。Flutter打造的电子商务。

我可以在Android中运行该项目(模拟器和设备=(。但iOS无法运行。我得到以下错误:

Launching lib/main.dart on iPhone 11 in debug mode...
Running pod install...
Running Xcode build...
Xcode build done.                                           138,6s
Failed to build iOS app
Could not build the application for the simulator.
Error launching application on iPhone 11.
Error output from Xcode build:
↳
** BUILD FAILED **

Xcode's output:
↳
/Users/user./projects/project/ios/Runner/AppDelegate.swift:3:8: error: no such module 'GoogleMaps'
import GoogleMaps
^
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

我在互联网上查找了这个问题的解决方案,但什么都不起作用。有人能帮帮我吗?

删除所有pod文件。运行CCD_ 1。然后转到iOS文件夹并运行pod init。它是创建一个pod文件。在target 'Runner' do之前添加pod 'GoogleMaps'此行

我分享我的pod文件代码

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
pod 'Firebase/Analytics'
pod 'GoogleMaps'
# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods
target 'Runner' do
# Comment the next line if you don't want to use dynamic frameworks

# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for Runner
end
flutter pub get
cd ios
pod install
pod update

如果项目仍然使用google_maps,您是否在pubspec.yaml中进行了检查?因为如果没有,那么应该删除AppDelegate.swift中的两行。(谷歌地图和GMSServices.provideAPIKey.的导入

这应该能解决问题。

确保您在appdelgate.swift 中导入谷歌地图

import UIKit
import Flutter
import GoogleMaps //This line
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GMSServices.provideAPIKey("MAP API KEY")
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

这个问题是因为您在xcode中的错误目录中打开了项目。如果你正确地打开它并尝试它,问题就会得到解决。

注:适用于Flutter项目。

相关内容

  • 没有找到相关文章

最新更新