Cordova-plugin-background-geolocation: ios: debug mode produces endless loop in notification handling

Created on 19 Nov 2019  路  6Comments  路  Source: mauron85/cordova-plugin-background-geolocation

Your Environment


  • Plugin version: 3.1.0
  • Platform: iOS
  • OS version: 13.1
  • Device manufacturer and model:
  • Running in Simulator: Yes
  • Cordova version (cordova -v): Capacitor 1.3.0
  • Cordova platform version (cordova platform ls):
  • Plugin configuration options: debug: true, desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY, saveBatteryOnBackground: true
  • Link to your project:

Context


In CDVBackgroundGeolocation, the notification delegate gets set:

center.delegate = self;

Immediately afterwards, in debug mode, this value gets stored in prevNotificationDelegate:

prevNotificationDelegate = center.delegate;
center.delegate = self;

When handling the notification, it calls always the handler of prevNotificationDelegate (which is self). This leads to and endless loop.

Expected Behavior


Notification should be handled in debug mode as well.

Actual Behavior


App crashes.

Possible Fix


IMHO prevNotificationDelegate is completely useless. Probably you can just remove it. Or at least call it only, if it != self.

Steps to Reproduce



1.
2.
3.
4.

Context

Debug logs

stale

Most helpful comment

Related to:
https://github.com/mauron85/cordova-plugin-background-geolocation/issues/645
https://github.com/mauron85/cordova-plugin-background-geolocation/pull/633

The latest and this one explain the issue details really well and address the fix.
Any maintaner or iOs dev to open a PR?

Temporary solution: disable debug mode in config

this.backgroundGeolocation.configure({
  // ...
  debug: false
  // ...
});

All 6 comments

any news on that?!

This still happens with @mauron85/cordova-plugin-background-geolocation@~3.1.0 + "@ionic-native/background-geolocation": "^5.22.0".

Schermata 2020-03-18 alle 12 26 39

Also system log reports: Service exited due to SIGSEGV | sent by exc handler[27280](segmentation fault due to too much recursion)

The fix proposed by @Ritzlgrmft it's mandatory to keep the iOs version working, otherwise it will just crash at start.

Is there any way to disable the notification?

Related to:
https://github.com/mauron85/cordova-plugin-background-geolocation/issues/645
https://github.com/mauron85/cordova-plugin-background-geolocation/pull/633

The latest and this one explain the issue details really well and address the fix.
Any maintaner or iOs dev to open a PR?

Temporary solution: disable debug mode in config

this.backgroundGeolocation.configure({
  // ...
  debug: false
  // ...
});

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

Oh why?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anusree-mmlab picture anusree-mmlab  路  5Comments

Shakti-Sharma picture Shakti-Sharma  路  3Comments

sasiadstar picture sasiadstar  路  4Comments

shyamal890 picture shyamal890  路  10Comments

mahmed-ntd picture mahmed-ntd  路  10Comments