如何解决由于UIWebView API已弃用,因此无法在Appstore上发布如何正确迁移到WKWebView?
由于UIWebView的API已弃用,我正在努力在App Store上发布Cordova应用程序。 ( ITMS-90809:不赞成使用的API-不再接受使用UIWebView的新应用)
我已经更新了各种插件的版本,并在.xml文件中添加了以下规则:
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">`
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
随后,我使用了cordova build ios
命令(无论如何,我注意到项目中仍然有UIWebView标记,但是据我所知这应该不是问题)。
这是.xml文件:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.driver.app" version="1.0.1" versionCode="1"
xmlns="http://www.w3.org/ns/widgets"
xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Driver App</name>
<description>
Driver App
</description>
<author email="info@creact.it" href="http://cordova.io">
jafood.it
</author>
<icon src="icon.png" />
<access origin="*" />
<allow-navigation href="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<access launch-external="yes" origin="tel:*" />
<content src="index.html" />
<preference name="orientation" value="portrait" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="SplashScreenDelay" value="10000" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="fullscreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28" />
<preference name="DisallowOverscroll" value="true" />
<preference name="cordova.plugins.diagnostic.modules" value="LOCATION WIFI CAMERA NOTIFICATIONS MICROPHONE CONTACTS CALENDAR REMINDERS" />
<platform name="android">
<replace-string file="project.properties" find="com.google.android.gms:play-services-maps:+" replace="com.google.android.gms:play-services-maps:15.0.0" />
<replace-string file="project.properties" find="com.google.android.gms:play-services-location:16.0.0" replace="com.google.android.gms:play-services-location:15.0.0" />
<replace-string file="project.properties" find="com.google.android.gms:play-services-location:28.+" replace="com.google.android.gms:play-services-location:15.0.0" />
<replace-string file="project.properties" find="com.google.android.gms:play-services-location:+" replace="com.google.android.gms:play-services-location:15.0.0" />
<replace-string file="project.properties" find="com.google.firebase:firebase-messaging:17.0.+" replace="com.google.firebase:firebase-messaging:17.0.0" />
<resource-file src="www/beep.wav" target="app/src/main/res/raw/beep.wav" />
<resource-file src="www/beep.wav" target="res/raw/beep.wav" />
<resource-file src="google-services.json" target="google-services.json" />
<resource-file src="google-services.json" target="app/google-services.json" />
<allow-intent href="market:*" />
<icon density="ldpi" src="res/icons/android/drawable-ldpi-icon.png" />
<icon density="mdpi" src="res/icons/android/drawable-mdpi-icon.png" />
<icon density="hdpi" src="res/icons/android/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="res/icons/android/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="res/icons/android/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="res/icons/android/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="res/screens/android/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="res/screens/android/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="res/screens/android/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="res/screens/android/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="res/screens/android/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="res/screens/android/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="res/screens/android/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="res/screens/android/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="res/screens/android/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="res/screens/android/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="res/screens/android/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="res/screens/android/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>Need location access to find restaurant nearby</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysAndWhenInUseUsageDescription">
<string>Need location access to find restaurant nearby</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
<string>Need location access to find restaurant nearby</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSCameraUsageDescription">
<string>need camera access to take pictures</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryUsageDescription">
<string>need to photo library access to get pictures from there</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
<string>need location access to find things nearby</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysAndWhenInUseUsageDescription">
<string>need location access to find things nearby</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSPhotoLibraryAddUsageDescription">
<string>need to photo library access to save pictures there</string>
</edit-config>
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
<string>need location access to find things nearby</string>
</edit-config>
<icon height="57" platform="ios" src="res/icons/ios/icon.png" width="57" />
<icon height="114" platform="ios" src="res/icons/ios/icon@2x.png" width="114" />
<icon height="40" platform="ios" src="res/icons/ios/icon-40.png" width="40" />
<icon height="80" platform="ios" src="res/icons/ios/icon-40@2x.png" width="80" />
<icon height="50" platform="ios" src="res/icons/ios/icon-50.png" width="50" />
<icon height="100" platform="ios" src="res/icons/ios/icon-50@2x.png" width="100" />
<icon height="60" platform="ios" src="res/icons/ios/icon-60.png" width="60" />
<icon height="120" platform="ios" src="res/icons/ios/icon-60@2x.png" width="120" />
<icon height="180" platform="ios" src="res/icons/ios/icon-60@3x.png" width="180" />
<icon height="72" platform="ios" src="res/icons/ios/icon-72.png" width="72" />
<icon height="144" platform="ios" src="res/icons/ios/icon-72@2x.png" width="144" />
<icon height="76" platform="ios" src="res/icons/ios/icon-76.png" width="76" />
<icon height="152" platform="ios" src="res/icons/ios/icon-76@2x.png" width="152" />
<icon height="29" platform="ios" src="res/icons/ios/icon-small.png" width="29" />
<icon height="58" platform="ios" src="res/icons/ios/icon-small@2x.png" width="58" />
<icon height="87" platform="ios" src="res/icons/ios/icon-small@3x.png" width="87" />
<icon height="1024" platform="ios" src="res/icons/ios/icon-1024.png" width="1024" />
<splash height="1136" platform="ios" src="res/screens/ios/Default-568h@2x~iphone.png" width="640" />
<splash height="1334" platform="ios" src="res/screens/ios/Default-667h.png" width="750" />
<splash height="2208" platform="ios" src="res/screens/ios/Default-736h.png" width="1242" />
<splash height="1242" platform="ios" src="res/screens/ios/Default-Landscape-736h.png" width="2208" />
<splash height="1536" platform="ios" src="res/screens/ios/Default-Landscape@2x~ipad.png" width="2048" />
<splash height="768" platform="ios" src="res/screens/ios/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" platform="ios" src="res/screens/ios/Default-Portrait@2x~ipad.png" width="1536" />
<splash height="1024" platform="ios" src="res/screens/ios/Default-Portrait~ipad.png" width="768" />
<splash height="960" platform="ios" src="res/screens/ios/Default@2x~iphone.png" width="640" />
<splash height="480" platform="ios" src="res/screens/ios/Default~iphone.png" width="320" />
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>
<plugin name="cordova-plugin-insomnia" spec="4.1.0" />
<plugin name="cordova-plugin-googlemaps-plus" spec="~1.4.0">
<variable name="API_KEY_FOR_ANDROID" value="AIzaSyCCbsxetNp6A0j0h8DmzgyBhqyGuTlpTOc" />
<variable name="API_KEY_FOR_IOS" value="AIzaSyCCbsxetNp6A0j0h8DmzgyBhqyGuTlpTOc" />
</plugin>
<plugin name="cordova-plugin-whitelist" spec="^1.3.4" />
<plugin name="cordova-plugin-device" spec="^2.0.3" />
<plugin name="cordova-plugin-inappbrowser" spec="^3.2.0" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.3" />
<plugin name="cordova-plugin-geolocation" spec="^4.0.2" />
<plugin name="cordova-plugin-network-information" spec="^2.0.2" />
<plugin name="cordova-plugin-x-toast" spec="^2.6.2" />
<plugin name="cordova-plugin-media" spec="^3.0.1" />
<plugin name="cordova-plugin-vibration" spec="^2.1.6" />
<plugin name="cordova-plugin-file-transfer" spec="^1.6.3" />
<plugin name="cordova-plugin-advanced-http" spec="^2.4.1">
<variable name="OKHTTP_VERSION" value="3.10.0" />
</plugin>
<plugin name="cordova-plugin-android-permissions" spec="^1.0.2" />
<plugin name="cordova-plugin-camera" spec="^4.1.0">
<variable name="CAMERA_USAGE_DESCRIPTION" value="" />
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="" />
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.+" />
</plugin>
<plugin name="cordova.plugins.diagnostic" spec="^5.0.1">
<variable name="ANDROID_SUPPORT_VERSION" value="28.+" />
</plugin>
<plugin name="cordova-android-support-gradle-release" spec="^3.0.1">
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-platform-replace" spec="^1.0.1" />
<plugin name="cordova-plugin-request-location-accuracy" spec="^2.3.0">
<variable name="PLAY_SERVICES_LOCATION_VERSION" value="15.0.0" />
</plugin>
<plugin name="cordova-support-google-services" spec="~1.3.2" />
<plugin name="cordova-plugin-mauron85-background-geolocation" spec="~3.0.1">
<variable name="GOOGLE_PLAY_SERVICES_VERSION" value="11+" />
<variable name="ANDROID_SUPPORT_LIBRARY_VERSION" value="26+" />
<variable name="ALWAYS_USAGE_DESCRIPTION" value="App requires ..." />
<variable name="MOTION_USAGE_DESCRIPTION" value="App requires motion detection" />
<variable name="SMALL_ICON" value="@mipmap/ic_launcher" />
<variable name="ICON" value="@mipmap/ic_launcher" />
</plugin>
<plugin name="cordova-plugin-buildinfo" spec="4.0.0" />
<plugin name="nl.x-services.plugins.insomnia" spec="~4.1.0" />
<plugin name="phonegap-plugin-push" spec="^2.3.0">
<variable name="SENDER_ID" value="85075801930" />
<variable name="ANDROID_SUPPORT_V13_VERSION" value="27.+" />
<variable name="FCM_VERSION" value="17.0.+" />
</plugin>
<engine name="android" spec="^8.1.0" />
<engine name="browser" spec="~5.0.4" />
<engine name="ios" spec="^4.5.5" />
</widget>
Appstore仍然拒绝发布。
我错过了一些步骤吗?
我怀疑在尝试发布该应用之前,我必须遵循不同的步骤来构建该应用。
解决方法
您正在使用preference
标志WKWebViewOnly
,它需要cordova-ios
个平台版本5.1.1
。您还需要添加cordova-plugin-wkwebview-engine
插件,以使cordova使用WKWebView
而不是UIWebView
。
请参阅此How to User 'WKWebViewOnly'
您的某些插件可能仍在使用UIWebView
。确保更新这些插件,例如:
cordova-plugin-inappbrowser
至4.0.0
一旦解决了UIWebView
的问题,并且如果使用文件协议在本地加载文件,则可能会遇到CORS问题。要解决这些问题,请在您的项目中添加以下两个插件。
cordova-plugin-wkwebview-file-xhr
cordova-plugin-wkwebviewxhrfix
您需要使用cordova-ios 6+,它会消失
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。