Comments (4)
<preference
name="scheme" value="app" />
added this, it works very well!! thank you very much for your help :)
from cordova-ios.
console reports "Failed to resolve host network app id" (btw, Safari in the XCode emulator can access API hosts)
This doesn't really sound like an error that cordova throws really. Is this error being shown in XCode console or the web console?
Also can you share your config.xml
file?
from cordova-ios.
this error is shown in XCode console.
<?xml version='1.0' encoding='utf-8'?> <widget id="com.helloworld.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> <name>HelloWorld</name> <description>Sample Apache Cordova App</description> <author email="[email protected]" href="https://cordova.apache.org"> Apache Cordova Team </author> <content src="index.html" /> <allow-intent href="http://*/*" /> <allow-intent href="https://*/*" /> </widget>
from cordova-ios.
I'm not really sure, but I definitely don't reproduce this though I don't use the VueJS framework as well. So I think this is more of a VueJS integration issue. It is possible that it assumes are more traditional web environment where you have a server, with a domain, etc... These things doesn't necessary exist in a webview environment.
Couple of things you can try:
Enabling url schemes
iOS webview has a concept of schemes, by default has this disabled. This means that you're web app is loaded over the file://
protocol, which the means the document has a null
origin, and the webview considers the document insecure and will disable a lot of different features.
If you add a platform
block in your config with the scheme
and hostname
preferences, it will enable the url scheme, which means you're document will be proxied through something that looks like a server and the document will have a proper origin and will be considered secure, for the purposes of enabling features locked normally locked behind https.
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.helloworld.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>HelloWorld</name>
<description>Sample Apache Cordova App</description>
<author email="[email protected]" href="https://cordova.apache.org"> Apache Cordova Team </author>
<content src="index.html" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<platform name="ios">
<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />
</platform>
</widget>
Couple of things to note:
-
We use the platform block because android also accept these preferences for their equivalent system, but iOS and android has different requirements where Android only accepts
http
orhttps
as the scheme and iOS requires you to use a non-reserved scheme wherehttp
andhttps
are reserved. This is why we choose something more custom, likeapp
for our ios scheme. -
Android defaults to
https://localhost
as the scheme instead of thefile://
protocol strategy, which may explain why VueJS works under the android webview out of the box.
Possibility of finding more insights
If the above fails... then we probably need to get more insights. I think on iOS, xcode will still log JS console messages, but if it is a message from JS, the web inspector may have more insightful information.
If you don't know how to use the Safari remote inspector, I have a blog post that describes how, just scroll down to the iOS section.
The key thing though is safari web inspector doesn't capture events that occurred before the inspector was attached, so in order to see log messages, network errors, or any debug information that occurred on launch, you'll need to refresh the webview with the inspector attached. This can be done by pressing cmd
+ r
on the inspector window.
from cordova-ios.
Related Issues (20)
- The CDVURLProtocol no longer exists, so how should we modify the interception? HOT 3
- The startURLSchemeTask method in CDVURLSchemeHandler was not executed HOT 2
- Copy deployment-target from root config.xml to platform-specific config.xml before usage in Podfile HOT 5
- WKWebViewConfiguration is always ignored
- Missing API declaration on iOS app submission to App Store HOT 5
- CDVPlugin's viewController should just be a CDVViewController
- CDVWebViewUIDelegate should take a CDVViewController
- Cordova ios 7.1.0 - Build failed with "Command failed with exit code 65" HOT 4
- Several version checks fail after cordova-ios platform add [email protected] HOT 2
- Target Identity info missing Display Name, Version, Build HOT 1
- plugin_not_installed errors after upgrading from 6.3.0 HOT 7
- IOS report "Failed to resolve host network app id" error, Android is working properly HOT 1
- Uninstall plugin with asset tag error HOT 2
- `deviceReady` event not fire HOT 2
- Problems with 'cordova platform add ios` – needs updating according to new apple standards HOT 3
- `cordova build ios` doesn't agree with Xcode recommendations HOT 1
- Fail to launch google map app even if comgooglemaps is included in LSApplicationQueriesSchemes HOT 3
- Outdated security policy HOT 1
- app gets stuck on the splash screen on its first run but works fine on subsequent runs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-ios.