Use of Unresolved Identifier 'GMSServices'

前端 未结 4 1137
刺人心
刺人心 2021-02-18 21:13

I am using Xcode 7.1 and the deployment target is iOS 9.1. The app is \"AreaCalculator\" and it was written in Swift. I did following to set up the framework and import the map:

相关标签:
4条回答
  • 2021-02-18 21:52

    Add this line in AppDelegate.m

    #import "GoogleMaps/GoogleMaps.h"
    
    0 讨论(0)
  • 2021-02-18 22:07

    For react native make sure you are importing from above to #if DEBUG mode.

    Put librarries above #if DEBUG
    
    #import "AppDelegate.h"
    
    #import <React/RCTBridge.h>
    #import <React/RCTBundleURLProvider.h>
    #import <React/RCTRootView.h>
    #import "RNSplashScreen.h" // here
    #import <GoogleMaps/GoogleMaps.h>
    #if DEBUG
    #import <FlipperKit/FlipperClient.h>
    #import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
    #import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
    #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
    #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
    #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>```
    
    Found here -> https://github.com/react-native-community/react-native-maps/issues/3453#issuecomment-665475820
    
    0 讨论(0)
  • 2021-02-18 22:11

    I have solved the problem by "import GoogleMaps" in the AppDelegate.swift.

    0 讨论(0)
  • 2021-02-18 22:12
    ....
    #add this line
    import GoogleMaps
    
    
    @UIApplicationMain
    @objc class AppDelegate: FlutterAppDelegate {
      override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
      ) -> Bool {
      GMSServices.provideAPIKey("YOUR-API-KEY")
        GeneratedPluginRegistrant.register(with: self)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
      }
    }
    
    0 讨论(0)
提交回复
热议问题