Skip to content

[iOS] unregister() promise seems to never be resolved #105

@Hvedrungr

Description

@Hvedrungr

Hi,

I’m facing an issue with the unregister() method returned by onNotificationReceived().
My app crashes whenever I try to log out (which triggers my component destruction and subsequently calls the unregister)

According to the type definition, unregister(): Promise<void> suggests it should eventually resolve or reject. However, in practice, neither .then() nor .catch() is ever called after invoking unregister().

The promise appears to remain in a pending state and this seems to cause the crash during my component destruction, as I'm unable to clean up listeners.

For your information, it works perfectly with multiple Android devices, and I can see the logs after the unregister promise has been resolved successfully.

const myListener = await onNotificationReceived((notif) => {
  // DOING STUFF HERE
});

this.destroyRef.onDestroy(() => {
  myListener
    .unregister()
    .then(() => this.logger.info("destroying myListener done"))
    .catch((err) =>
      this.logger.error(
        "destroying myListener error " + err.toString(),
      ),
    );
});

Is it a known issue ? Am I missing something ?
Thanks a lot for your help !


Plugin version: 0.4.2
Platform: iOS 18

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions