defaultWebpagePreferences error while building ios build for ionic 5 code

defaultWebpagePreferences error while building ios build for ionic 5 code

我正在尝试为 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;

您的 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 的后续补丁版本中解决了其他问题。