【问题标题】:defaultWebpagePreferences error while building ios build for ionic 5 code为 ionic 5 代码构建 ios 构建时出现 defaultWebpagePreferences 错误
【发布时间】:2021-02-09 17:02:50
【问题描述】:

我正在尝试为 ionic 5 应用程序构建 ios 版本,我在构建应用程序时在我的应用程序中收到此错误。我在互联网上寻找解决方案,但似乎没有任何效果

/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:141:27: error: property
      'defaultWebpagePreferences' not found on object of type 'WKWebViewConfiguration *'
            configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeMobile;
                          ^
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:141:76: error: use of undeclared
      identifier 'WKContentModeMobile'
            configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeMobile;
                                                                           ^
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:143:27: error: property
      'defaultWebpagePreferences' not found on object of type 'WKWebViewConfiguration *'
            configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeDesktop;
                          ^
/Users/Prateek/ionicApps/muniFlores/platforms/ios/CordovaLib/Classes/Private/Plugins/CDVWebViewEngine/CDVWebViewEngine.m:143:76: error: use of undeclared
      identifier 'WKContentModeDesktop'
            configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeDesktop;

【问题讨论】:

    标签: cordova ionic-framework cordova-plugins ionic5 wkwebviewconfiguration


    【解决方案1】:

    您的 Xcode 版本可能是您的 Cordova iOS 平台不支持的版本。如果您降级您的cordova-ios 平台版本,它应该可以工作。尽管如此,我还是强烈建议您尽可能更新您的 Xcode。

    此更改是在版本 6.1.0 中引入的。在此处检查提交:https://github.com/apache/cordova-ios/commit/440fc0fe01dabbccfd703ac7854fd24b0b88e1b5

    这意味着使用 ios 平台的6.0.0 版本可能有效。安装:

    cordova platform rm ios
    cordova platform install ios@6.0.0
    

    但这个版本还有一些其他问题在以后的 cordova-ios 补丁版本中得到解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-27
      • 1970-01-01
      • 2015-09-03
      • 2016-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多