capacitor-background-geolocation icon indicating copy to clipboard operation
capacitor-background-geolocation copied to clipboard

BackgroundGeolocation.ready method is crashing in iOS

Open Madserker opened this issue 9 months ago • 8 comments

Your Environment

  • Plugin version:
    "@transistorsoft/capacitor-background-fetch": "^5.2.5", "@transistorsoft/capacitor-background-geolocation": "^5.4.2",
  • Platform: iOS
  • Device OS version: 15.5
  • Device manufacturer / model: iPone Xr
  • XCode version: 15.3
  • Capacitor info (npx cap doctor): image
  • Plugin config provided to #ready:
{
    desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
    distanceFilter: 10,
    stopTimeout: 5,
    debug: true, 
    logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
    stopOnTerminate: false,  
    startOnBoot: true, 
    preventSuspend: true,
    backgroundPermissionRationale: {
      title: "Allow EYE to access to this device's location in the background for the Geofencing feature?",
      message: "In order to track your activity in the background, please enable \"Allow all the time\" location permission",
      positiveAction: "Change to \"Allow all the time\"",
      negativeAction: "No, I won't use Geofencing"
    }
}

Expected Behavior

The method BackgroundGeolocation.ready does not crash on iOS

Actual Behavior

BackgroundGeolocation.ready crashes only on iOS and getting the following error: Error: "BackgroundGeolocation.ready()" is not implemented on ios CapacitorException — index.js:85 (anonymous function) — index.js:202 onInvoke — core.mjs:14697 run — zone.js:129 (anonymous function) — zone.js:1257 onInvokeTask — core.mjs:14374 onInvokeTask — core.mjs:14684 runTask — zone.js:173 drainMicroTaskQueue — zone.js:581 promiseReactionJob

Context

Im trying to use the library capacitor-background-geolocation in my Capacitor project, so I did all the setup for iOS and Android of the libraries capacitor-background-fetch and capacitor-background-geolocation and used it in my project but for some reason in Android works completely perfect but in iOS it crashes on the BackgroundGeolocation.ready method giving me the error "BackgroundGeolocation.ready()" is not implemented on ios. I don't know if i am missing something in the configuration of the ready or maybe I need a license code in iOS? This is the code that im trying to execute:

image

Madserker avatar Apr 26 '24 13:04 Madserker

BackgroundGeolocation.ready()" is not implemented on ios

Your Capacitor app thinks the plug-in isn’t installed, so go back and follow the Setup Instructions again,

christocracy avatar Apr 26 '24 13:04 christocracy

I followed all the steps for both libraries (geolocation and fetch) and checked them again three times and everything seems to be correct. The backgroundModes, the info.plist, the PrivacyInfo.xcprivacy and the AppDelegate all are changed as the instructions say.

Madserker avatar Apr 26 '24 13:04 Madserker

Did you run $ npx cap sync?

christocracy avatar Apr 26 '24 13:04 christocracy

Yes, also cleaned the project, deleted derived data, did pod deintegrate and pod install, and nothing seems to work

Madserker avatar Apr 26 '24 13:04 Madserker

show me the result of:

npm uninstall @transistorsoft/capacitor-background-geolocation
npm install @transistorsoft/capacitor-background-geolocation

christocracy avatar Apr 26 '24 13:04 christocracy

I created a simple hello-world app and everything worked fine.

I also just released Capacitor v6 updates for both @transistorsoft/capacitor-background-fetch and @transistorsoft/capacitor-background-geolocation

christocracy avatar Apr 26 '24 15:04 christocracy

Hello! I tried this and same result:

npm uninstall @transistorsoft/capacitor-background-geolocation
npm install @transistorsoft/capacitor-background-geolocation

Tried also with the new version 6.0.0 and nothing.

But your example/angular code is working fine in iOS to me, so I must have surely something different. But I still can't figure it out what it is. I checked everything in xCode. Could it be related to the bundle ID and singing and the license key? cause i still don't have license key yet but im launching it in Debug mode.

Madserker avatar Apr 29 '24 12:04 Madserker

Could it be related to the bundle ID and singing and the license key?

No.

create yourself a simple “hello-world” app to practice setting up and using the plug-in.

christocracy avatar Apr 29 '24 12:04 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar May 30 '24 01:05 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 13 '24 01:06 github-actions[bot]