ios: debug mode produces endless loop in notification handling
See original GitHub issueYour 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
Context
Debug logs
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
How to debug infinite loop "crash" in Xcode for iOS involving ...
But the non-crash - it's an infinite loop - occurs when the search results table is being displayed / updated, after a call...
Read more >Loop that works in debug but not release. - Apple Developer
This code works fine in debug mode, but invariably crashes in release mode. The values have all been used previously in the loop,...
Read more >How to debug infinite loop "crash" in Xcode for iOS involving ...
Coding example for the question How to debug infinite loop "crash" in Xcode for iOS involving CALayer and view layout during search?
Read more >Infinite loop of "callbacks_poll" #1538 - realm/realm-js - GitHub
This is used only in debugging to be able to support handling arbitrary callbacks called from the device side. This method is called...
Read more >Debugging Auto Layout feedback loops - Hacking with Swift
Here's how to try it out: Go to the Product menu, hold down Option, and choose “Run…”
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 still happens with
@mauron85/cordova-plugin-background-geolocation@~3.1.0 + "@ionic-native/background-geolocation": "^5.22.0"
.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?