Skip to content

ios: debug mode produces endless loop in notification handling #657

@Ritzlgrmft

Description

@Ritzlgrmft

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

Context

Debug logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleauto labeled abandoned issues after a period of inactivity

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions