You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works the first time, I do this. But when repeating the same flow later, the listener is never called
Expected Behavior
I expect the listener to be called when I add the listener
Reproduction Steps
See "Current Behavior"
Resolution
The reason for the error is in CAPPlugin.m, the method "notifyListeners:data:retainUntilConsumed:". Here, there is a check for "listenersForEvent==nil". The problem is, that after adding and removing a listener, the "listenersForEvent" is not nill, but an empty array.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.
Bug Report
Calling a combination of addListener:, removeListener:, and notifyListeners:data:retainUntilConsumed: causes the notification to disappear
Capacitor Version
Version 1.2 but also latest version on Github as per 23/10/2019
npx cap doctor
output:💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 1.2.1
@capacitor/core: 1.2.1
@capacitor/android: 1.2.1
@capacitor/ios: 1.2.1
Installed Dependencies:
@capacitor/cli 1.2.0
@capacitor/core 1.2.0
@capacitor/android 1.2.0
@capacitor/ios 1.2.0
[success] Android looking great! 👌
Found 2 Capacitor plugins for ios:
cordova-plugin-advanced-http (2.2.0)
cordova-plugin-file (6.0.2)
[success] iOS looking great! 👌
Affected Platform(s)
Current Behavior
I have created my own CAPPlugin subclass, where I call:
At some point after this, my typescript files starts listening for "event":
This works the first time, I do this. But when repeating the same flow later, the listener is never called
Expected Behavior
I expect the listener to be called when I add the listener
Reproduction Steps
See "Current Behavior"
Resolution
The reason for the error is in CAPPlugin.m, the method "notifyListeners:data:retainUntilConsumed:". Here, there is a check for "listenersForEvent==nil". The problem is, that after adding and removing a listener, the "listenersForEvent" is not nill, but an empty array.
Please apply this pull request / this patch to fix the problem:
The text was updated successfully, but these errors were encountered: