transistorsoft / flutter_background_geolocation_firebase

Firebase proxy for Flutter Background Geolocation SDK
MIT License
20 stars 7 forks source link

iOS Setup instructions in Swift #24

Open wizawuza opened 3 years ago

wizawuza commented 3 years ago

Is your feature request related to a problem? Please describe. There are currently instructions to set up in iOS at https://github.com/transistorsoft/flutter_background_geolocation_firebase/blob/master/help/INSTALL-IOS.md

Describe the solution you'd like Please add the specific instructions if we have an AppDelegate.swift file

Thank you.

christocracy commented 3 years ago

That's easy

rc8marcelo commented 3 months ago

Sharing how it looks for me, the placement of configure is important because if you place it after GeneratedPluginRegsitrant.register(with: self), it would cause a crash.

import Flutter
import UIKit
import Firebase

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
    FirebaseApp.configure()
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}