[Bug]: iOS with golang static lib webview load failure #7844
Labels
needs reply
needs reply from the user
needs reproduction
needs reproducible example to illustrate the issue
Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 7.0.1
@capacitor/core: 7.0.1
@capacitor/android: 7.0.1
@capacitor/ios: 7.0.1
Installed Dependencies:
@capacitor/android: not installed
@capacitor/cli: 7.0.1
@capacitor/core: 7.0.1
@capacitor/ios: 7.0.1
[success] iOS looking great! 👌
Other API Details
Platforms Affected
Current Behavior
I have custom native code to add a gomobile static lib as a framework. When I switched to use my bundled site in
public
for prod, it failed with:This happens in both simulator and physical iPhone (both iOS 18.2).
This error returns exactly one search result: #6974 . It's closed, but nevertheless:
serverUrl
it's not triggeredThe gomobile command used was:
gomobile bind -ldflags="-s" -target ios -tags ios -o ./ios/App/Pld.xcframework
Expected Behavior
Webview should load normally & peacefully.
Project Reproduction
it's not easy to do atm...
Additional Information
I managed to find a workaround through
MyViewController
(see docs for how to set it up). The actual fix is a one-liner, but to set it up is quite tedious, especially if you're not already using a custom view controller.My understanding is that the non-deterministic behavior of
URL(fileURLWithPath:)
occurs when the path is empty. Normally an empty path translates tofile:///
which is equivalent to passing/
.God knows what combination of things causes this to happen, but if Capacitor can avoid this non-determinism perhaps that's an improvement? It certainly is for me (and clearly, whoever posted that other issue). Happy to send a PR if so.
(Obligatory thanks for a great framework. I'm new to mobile dev and I can't thank the contributors enough.)
The text was updated successfully, but these errors were encountered: