Lyn
Lyn

Reputation: 209

didFinishLaunchingWithOptions getting called more than once on IOS

I'm writing a flutter app which will use the native Location library and I notice that the didFinishLaunchingWithOptions for IOS gets called multiple times making me having more than one CLLocationManager instances running.

My xcode log console prints the "region monitoring: didFinishLaunchingWithOptions" multiple times. Is there a reason why it gets called multiple time or a workaround to avoid having more than one CLLocationManager instances

override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
  ) -> Bool {
      NSLog("region monitoring: didFinishLaunchingWithOptions")
      self.locationManager = CLLocationManager()
      self.locationManager.delegate = self
      
    
    GeneratedPluginRegistrant.register(with: self)
    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}

Upvotes: 0

Views: 107

Answers (0)

Related Questions