簡體   English   中英

由於已棄用 UIWebView API,無法在 Appstore 上發布。如何正確遷移到 WKWebView?

[英]Can't publish on Appstore because of the deprecated UIWebView API. How can I migrate to WKWebView correctly?

由於 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

請參考這個 如何使用'WKWebViewOnly'

您的某些插件可能仍在使用UIWebView 確保將這些插件更新為: cordova-plugin-inappbrowser4.0.0

解決UIWebView問題后,如果您使用文件協議在本地加載文件,則可能會遇到 CORS 問題。 要修復這些問題,請將以下兩個插件添加到您的項目中。

cordova-plugin-wkwebview-file-xhr

cordova-plugin-wkwebviewxhrfix

你需要使用 cordova-ios 6+ 並且它消失了

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM