Closed JanMisker closed 3 months ago
The provided app doesn't include any removeAllListeners()
call, can you update it?
Are you sure you updated correctly? looks like you updated your plugins to Capacitor 6 but you are still using @capacitor/ios
5.x.
Sorry my bad I wasn't using the src dir, I modified the repository to show the issue. I just put everything in src/index.html
.
I do use the 6 version of ios, as you can see in the package.json
.
Below screenshot of what happens when running on iOS vs. Android emulator
iOS:
Android:
This issue has been labeled as type: bug
. This label is added to issues that that have been reproduced and are being tracked in our internal issue tracker.
Oh, yeah, since you changed the sample to not import the plugin, the common methods like removeAllListeners
don't get generated since that's generated from javascript.
I guess we could generate it from native too as we do for addListeners
so it's available even if the plugin is not imported.
But if you import the plugin, the removeAllListeners
method is available and works as expected, the problem is just a matter of generating method for being accessible from Capacitor.Plugins.PluginName
, which is technically deprecated.
One of our projects is really old and "vanilla" javascript, not using modules. So we'd have to find a way to include that generated plugin code without imports.
Still, isn't it strange that that same sample project, so without importing the plugin, does seem to work on Android? In the sense that the function is not undefined as you can see in the 2nd screenshot.
This is an iOS issue only, on Android the plugins methods have annotations that auto generate the javascript and removeAllListeners
is one of the base plugin class methods, but on iOS no such thing exists, so they have to be generated programmatically.
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.
Capacitor Version
[warn] The bundledWebRuntime configuration option has been deprecated. Can be safely deleted. 💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/android: 6.0.0 @capacitor/ios: 6.0.0
Installed Dependencies:
@capacitor/cli: 6.0.0 @capacitor/core: 6.0.0 @capacitor/ios: 6.0.0 @capacitor/android: 6.0.0
[success] iOS looking great! 👌 [success] Android looking great! 👌
Other API Details
Platforms Affected
Current Behavior
On iOS the
removeAllListeners()
function on plugins isundefined
, whereas on Android it exists as expected. I reproduced for PushNotifications but also checked it via console for built-in plugins like Camera.Maybe has to do with this: https://capacitorjs.com/docs/updating/plugins/6-0#remove-removealllisteners-method
Expected Behavior
The
removeAllListeners()
function should work the same on iOS and Android.Project Reproduction
https://github.com/JanMisker/TestPushNotifRemoveAll
Additional Information
No response