question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: Can't access savePluginCall in iOS plugin

See original GitHub issue

Bug Report

Capacitor Version

Latest Dependencies:

  @capacitor/cli: 2.4.6
  @capacitor/core: 2.4.6
  @capacitor/android: 2.4.6
  @capacitor/electron: 2.4.6
  @capacitor/ios: 2.4.6

Installed Dependencies:

  @capacitor/cli 2.4.5
  @capacitor/core 2.4.5
  @capacitor/android 2.4.5
  @capacitor/ios 2.4.5
  @capacitor/electron not installed

Platform(s)

iOS

Current Behavior

On Android, when perfrorming async tasks, I can saveCall(call) and then access a saved call using savedCall.

On iOS, I can try to get a call with let call = self.bridge.getSavedCall(callbackId!), but self.bridge.savePluginCall(call) is inaccessible due to protection level.

Expected Behavior

I expect to be able to save and retrieve plugin calls in iOS

Code Reproduction

No need, literally just create a new capacitor plugin project, and try to save / retrieve a call in iOS

Other Technical Details

npm --version output:

npm: '6.14.4',
  ares: '1.16.0',
  brotli: '1.0.7',
  cldr: '36.1',
  icu: '66.1',
  llhttp: '2.0.4',
  modules: '83',
  napi: '6',
  nghttp2: '1.40.0',
  node: '14.2.0',
  openssl: '1.1.1g',
  tz: '2019c',
  unicode: '13.0',
  uv: '1.37.0',
  v8: '8.1.307.31-node.33',
  zlib: '1.2.11'

node --version output: v14.2.0

pod --version output (iOS issues only): 1.8.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
ikeithcommented, Jan 19, 2021

So it looks like there are several issues at play here:

  • The preferred way to save/retrieve a call is unclear and the platforms have conflicting APIs. We need to determine the one true pattern, implement it everywhere, and document the result. There’s a new issue to track that work: https://github.com/ionic-team/capacitor/issues/4087
  • Relatedly, some of this has already been changed for 3.0. Android’s getSavedCall on the plugin has been deprecated because a) it duplicated behavior and b) it was only a single property and could get overwritten.
  • getSavedCall on the bridge in iOS may not be working correctly.

As to the last item, when are you calling getSavedCall()? save() on CAPluginCall sets a flag to store it later, but that doesn’t actually happen until the plugin method returns. So it should work when it is called from an async method in the future but it won’t work immediately after calling save().

In the meantime, you can simply keep the call in a local property instead of relying on the built-in machinery. That’s not ideal but it should work in most situations while things get sorted out.

0reactions
ionitron-bot[bot]commented, Nov 11, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bypass, remove, or rescan Audio Units plug-ins in Logic Pro ...
If you can't open Logic Pro or MainStage, remove the installer files for third-party Audio Units: Find the installed plug-in file on your...
Read more >
iOS unable to find plugins, Android fine - xcode - Stack Overflow
In XCode, goto Build Phases -> open the Compiled Sources dropdown. Click + and add the missing plugin .m file that should be...
Read more >
iOS Troubleshooting Guide | Capacitor Documentation
This guide attempts to document common iOS/Xcode issues with possible ... If still getting the "Plugin not implemented" error, make sure you don't...
Read more >
Plugin doesn't support Xcode projects - Help - Apollo GraphQL
Error when configuring code generation in iOS app with SPM via Xcode: ... then ApolloCodeGenPlugin-Initialize, I get 2 logs in the Report ...
Read more >
iOS 'Only one accessory can be used at a time' error - 9to5Mac
We're almost at the end of the iOS 14 cycle but there's a bug that ... iPhone to their cars, sometimes they get...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found