Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can't Inspect WebView on iOS when setup with SPM #7406

Closed
1 of 3 tasks
abegehr opened this issue Apr 16, 2024 · 3 comments
Closed
1 of 3 tasks

[Bug]: Can't Inspect WebView on iOS when setup with SPM #7406

abegehr opened this issue Apr 16, 2024 · 3 comments
Labels

Comments

@abegehr
Copy link

abegehr commented Apr 16, 2024

Capacitor Version

💊 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/android: not installed
@capacitor/cli: 6.0.0
@capacitor/core: 6.0.0
@capacitor/ios: 6.0.0

[success] iOS looking great! 👌

Other API Details

npm: 10.5.1
node: 20.9.0
pod: 1.14.3

Platforms Affected

  • iOS
  • Android
  • Web

Current Behavior

"No inspectable applications." on Safari for iOS projects setup with SPM (npx cap add ios --packagemanager SPM).

Expected Behavior

I'd expect to inspect the web view through Safari.

Project Reproduction

https://github.com/abegehr/capacitor-sample

Additional Information

When I delete the ios folder and re-init without SPM (npx cap add iOS), the web view is inspectable in safari as expected. Therefore I think it is a problem with the SPM setup.

@abegehr abegehr added the triage label Apr 16, 2024
abegehr added a commit to abegehr/capacitor-sample that referenced this issue Apr 16, 2024
ref ionic-team/capacitor#7406
➜  capacitor-sample git:(main) ✗ rm -rd ios
➜  capacitor-sample git:(main) ✗ npx cap add ios --packagemanager SPM
@jcesarmobile
Copy link
Member

Sadly on iOS the xcframeworks are always in Release mode, and for SPM we have to create .xcframeworks because Capacitor is mixed Objective-C and Swift source, which prevents from building a regular SPM.
Since xcframeworks are in Release mode, by default WebView inspection doesn't work because the default value is to check if it's in DEBUG mode, which is always false for xcframeworks.

So, if you want to inspect the WebView you'll have to set ios.webContentsDebuggingEnabled to true in your capacitor config file, that makes the WebView inspectable even in production builds, but you have to remember to remove it before you publish the actual production build.

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2024
abegehr added a commit to abegehr/capacitor-docs that referenced this issue Apr 16, 2024
@abegehr
Copy link
Author

abegehr commented Apr 16, 2024

Thank you for explaining, @jcesarmobile! I opened a PR on the docs repo to add a note on this: ionic-team/capacitor-docs#299

Copy link

ionitron-bot bot commented May 16, 2024

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants