1
我想要在我的iPhone上運行Cordova內部的簡單JavaScript應用程序。 該項目在模擬器內工作得很好,但在手機上運行時會顯示一個奇怪的屏幕。科爾多瓦WKWebView白色屏幕
這是我的config.xml文件:
<widget
id="com.landonschropp.tictactoe"
version="1.0.0"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Tic-Tac-Toe</name>
<description>An awesome little tic-tac-toe game.</description>
<author email="[email protected]" href="https://landonschropp.com">Landon Schropp</author>
<content src="http://localhost:8080" />
<access origin="*" />
<allow-navigation href="http://localhost:8080/*" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
<plugin
name="cordova-plugin-wkwebview-engine"
spec="git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git" />
<engine name="ios" spec="^4.4.0" />
</widget>
和我的package.json文件:
{
"name": "tic_tac_toe",
"description": "A simple tic-tac-toe game",
"dependencies": {
"axios": "^0.16.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"cheerio": "^0.22.0",
"cordova": "^7.0.0",
"cordova-ios": "^4.4.0",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-whitelist": "^1.3.2",
"cordova-plugin-wkwebview-engine": "git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git",
"gulp": "^3.9.1",
"gulp-connect": "^5.0.0",
"gulp-file-cache": "^0.0.1",
"gulp-sass": "^3.1.0",
"gulp-sass-glob": "^1.0.8",
"gulp-transform": "^1.1.0",
"gulp-util": "^3.0.8",
"gulp-watch": "^4.3.11",
"lodash": "^4.17.4",
"phaser": "^2.6.2",
"rollup": "^0.41.6",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-json": "^2.1.1",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-stream": "^1.19.0",
"run-sequence": "^1.2.2",
"vinyl-source-stream": "^1.1.0"
},
"devDependencies": {
"babel-register": "^6.24.1",
"chai": "^3.5.0",
"del": "^2.2.2",
"eslint": "^3.19.0",
"mocha": "^3.2.0"
},
"cordova": {
"platforms": [
"ios"
],
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-wkwebview-engine": {},
"cordova-plugin-statusbar": {}
}
}
}
要構建並運行應用程序,我執行以下操作:
yarn install
cordova platform add ios
cordova run ios
目前,運行在手機上的應用程序,我看到下面的畫面時:
如果有幫助,這是一個鏈接到完整的回購:https://github.com/LandonSchropp/tic_tac_toe。 – LandonSchropp
Landon,http:// localhost:8080看起來相當可疑。你確定它可以從你的手機到達嗎?如果你的Mac上有服務器,也許值得指定你的Mac的IP地址,以允許手機連接到它(如果電話和Mac在同一網絡當然) – dymv
@dymv我的印象是'cordova- plugin-wkwebview-engine'插件在iPhone上運行本地服務器。不是嗎? – LandonSchropp