rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
288 stars 328 forks source link

No such module 'background_locator' #269

Open heshesh2010 opened 2 years ago

heshesh2010 commented 2 years ago

when run app from xcode it says :

No such module 'background_locator'

import UIKit import Flutter import GoogleMaps import background_locator

func registerPlugins(registry: FlutterPluginRegistry) -> () { if (!registry.hasPlugin("BackgroundLocatorPlugin")) { GeneratedPluginRegistrant.register(with: registry) } }

@UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GMSServices.provideAPIKey("XXX") BackgroundLocatorPlugin.setPluginRegistrantCallback(registerPlugins) GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } }

mehdok commented 2 years ago

Hi @heshesh2010 Thank you for opening an issue;

Try run flutter pub get, if it didn't solve the issue run pod install in iOS directory; As always clean and build in Xcode might help;

yacineblr commented 2 years ago

I have the same problem with Xcode 13. The build works when I go to command line with flutter "flutter build ios" but not with Xcode

Capture d’écran 2021-10-18 à 02 06 40

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-x64, locale fr)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.1)
[✓] VS Code (version 1.61.0)
[✓] Connected device (1 available)

! Doctor found issues in 1 category.

Update: This was not a problem with this library but on the side of my ios project that was "corrupted", I renamed my ios folder (ex: ios-tmp) then I recreated the ios folder with "flutter create ." and I put back my files one by one (.plist, podfile etc..)

BasharShehab commented 2 years ago

same issue. Did anyone find a solution? I tried the solution @yacineblr suggested but it didn't work. Same problem.

BasharShehab commented 2 years ago

Update: Here's the solution:

https://github.com/rekab-app/background_locator/issues/45#issuecomment-620456745