當我使用 Adob??e PhoneGap Build 時,我的應用程式出現了顯示問題。不知何故,我通過將 UIWebveiw 遷移到 WKwebview 解決了這個問題。由于 PhoneGap Build 結束了它的服務,我正在嘗試使用 cordova 命令來構建我的應用程式,并且出現了同樣的問題。
我嘗試了幾個 config.xml 設定,還嘗試將 Xcode 的“構建設定”>“用戶定義”>“WK_WEB_VIEW_ONLY”設定為 1。但仍然有這個問題。
我不確定我是否使用 WKwebview。如果沒有,我的設定有什么問題?如果是的話,我應該在bebug旁邊嘗試什么?
這是我構建應用程式的方式:
- 我通過創建我的專案
cordova create <Folder> <BundleID> <MyProjectName> - 將我的網站放入“www”檔案夾
- 然后
cordova platform add ios(我使用的是[email protected]) - 單擊我的 .xcodeproj 并單擊 Xcode 中的構建按鈕(三角形按鈕,如“播放”)。
這是我的 config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.test.test" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>test</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://*/*" />
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</widget>
我的檔案圖片
這是我的 main.m ,我不熟悉 swift 但似乎在我的應用程式中使用 UIWebveiw 而不是 WKwebview 。
#import <UIKit/UIKit.h>
int main(int argc, char* argv[])
{
@autoreleasepool {
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
return retVal;
}
}
這個問題困擾了我很長時間,我不知道為什么以及如何。提前謝謝你。
uj5u.com熱心網友回復:
如果您已升級到 Cordova iOS 6 ,則無需再指定 WKWebView,因為它默認為 WebView。
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
這些在 Cordova 中已過時
看到這個和這個
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/482853.html
標籤:IOS 迅速 科尔多瓦 uiwebview wkwebview
上一篇:如何讓我的敵人追逐我的玩家?
