derTuca / flutter_google_places_picker

Google Places Autocomplete for Flutter
MIT License
18 stars 28 forks source link

ios didFinishLaunchingWithOptions build issue #8

Closed deepdarksee closed 5 years ago

deepdarksee commented 5 years ago

The docs say to modify AppDelegate.m/.swift in ios/Runner, but the current dev environment has didFinishLaunchingWithOptions in the file AppDelegate.swift. When I insert the recommended Swift code I get the following build errors (xxx used for privacy):

/Users/xxx/AndroidStudioProjects/xxx/ios/Runner/AppDelegate.swift:11:5: error: use of unresolved identifier 'GMSPlacesClient'
        GMSPlacesClient.provideAPIKey("xxx")
/Users/xxx/AndroidStudioProjects/xxx/ios/Runner/AppDelegate.swift:12:5: error: use of unresolved identifier 'GMSSServices'
        GMSSServices.provideAPIKey("xxx")

Here is the AppDelegate.swift file content:

import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)
    GMSPlacesClient.provideAPIKey("xxx")
    GMSSServices.provideAPIKey("xxx")
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

flutter doctor

[✓] Flutter (Channel dev, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-US)
    • Flutter version 1.2.1 at /Users/spencernassar/dev/flutter
    • Framework revision 8661d8aecd (4 days ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/spencernassar/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.0.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] Connected device (2 available)
    • Android SDK built for x86 • emulator-5554                        • android-x86 • Android 9 (API 28) (emulator)
    • iPhone XR                 • 848A0357-2236-4306-8992-BCE930A2FB65 • ios         • iOS 12.1 (simulator)

• No issues found!
deepdarksee commented 5 years ago

Got a clean build by adding imports to the AppDelegate file and fixing a typo in "GMSSServices" (too many S's). Recommend you address both these in the installation instructions.

import GooglePlaces
import GoogleMaps
derTuca commented 5 years ago

Thanks for the suggestion!