如何检查我使用WKWebView而不是Cordova应用中的UIWebView

发布于 2025-01-30 17:28:31 字数 2194 浏览 4 评论 0 原文

当我使用Adobe PhoneGap构建时,我的应用程序存在显示问题。我以某种方式通过将UIWebVeiw迁移到WKWebView解决了它。由于PhoneGap构建结束了其服务,因此我试图使用Cordova命令来构建我的应用程序,并且也会发生同样的问题。

我尝试了几个config.xml设置,还尝试了设置Xcode的“构建设置”> “用户定义”> “ wk_web_view_only”为1。但仍然有这个问题。

我不确定我是否正在使用wkwebview。如果没有,我的设置怎么了?如果是,我应该在贝布格旁边尝试什么?

这是我构建应用程序的方式:

  1. 我通过 cordova create<文件夹创建项目。 < bundled> < myProjectName>
  2. 将我的网站放入“ www”文件夹
  3. ,然后 cordova平台添加ios (我使用 [email  procearted]
  4. 单击my .xcodeproj,然后单击xccode build bult bult(play play play'')。

这是我的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>

我的文件image

这是我的main.m.m,我不熟悉Swift,但似乎在我的应用中使用UIWebVeiw而不是WKWebView。

#import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }
}

问题是困扰着我很长一段时间,我无法弄清楚为什么以及如何。 谢谢您。

My app had a display problem when I used Adobe PhoneGap Build. Somehow I solved it via migrating UIWebveiw to WKwebview. Since PhoneGap Build ends its service, I am trying to use cordova command to build my app and same problem occurs.

I tried several config.xml settings and also tried setting Xcode's "Build Settings" > "User-Defined" > "WK_WEB_VIEW_ONLY" into 1. but still had this problem.

I am not sure whether I am using WKwebview or not. And If not, what's wrong with my setting? And If yes, what should I try next to bebug?

Here's how I build my app:

  1. I create my project via cordova create <Folder> <BundleID> <MyProjectName>
  2. put my website into "www" folder
  3. then cordova platform add ios (I am using [email protected])
  4. click my .xcodeproj and click build button (the triangle button like "play") in Xcode.

Here's my 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>

my files image

Here's my main.m , I am not familiar with swift but it seems like using UIWebveiw instead of WKwebview in my app.

#import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }
}

The problem is haunting me for a long time and I can't figure out why and how.
Thank you in advanced.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱格式化 2025-02-06 17:28:31

如果您已升级到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)过时,

请参见 href =“ https://cordova.apache.org/announcements/2021/02/04/cordova-ios-release-6.2.0.html” rel =“ nofollow noreferrer”> this

If you have upgraded to Cordova iOS 6+, there is no need to specify WKWebView anymore as it is the WebView by default.

<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />

These are obsolete with Cordova

See this and this

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文