Reputation: 21
I'm struggling to publish a Cordova application on the App Store because of the deprecated API of UIWebView. (ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted)
I have updated the version of the various plugins and added the following rules to the .xml file:
<preference name="WKWebViewOnly" value="true" />
<feature name="CDVWKWebViewEngine">`
<param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
Subsequently, I used the cordova build ios
command (I've noticed anyway that in the project there are still the UIWebView tags, but from what I know this should not be a problem).
Here's the .xml file:
<?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="[email protected]" 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/[email protected]" 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/[email protected]" 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/[email protected]" 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/[email protected]" width="120" />
<icon height="180" platform="ios" src="res/icons/ios/[email protected]" 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/[email protected]" 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/[email protected]" 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/[email protected]" width="58" />
<icon height="87" platform="ios" src="res/icons/ios/[email protected]" 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>
The Appstore still rejects to publish.
Did I miss some steps?
I suspect I have to follow different steps to build the app before trying to publish it.
Upvotes: 2
Views: 319
Reputation: 356
You are using preference
flag WKWebViewOnly
and it requires cordova-ios
platforms version 5.1.1
. You also need to add cordova-plugin-wkwebview-engine
plugin to make cordova use WKWebView
instead of UIWebView
.
Please refer to this How to User 'WKWebViewOnly'
Some of your plugins might still be using UIWebView
. Make sure to update those plugins like:
cordova-plugin-inappbrowser
to 4.0.0
Once you have fixed the issue with UIWebView
and if you are using file protocol to load files locally, you might get CORS issues. To fix those add the below two plugins to your project.
cordova-plugin-wkwebview-file-xhr
cordova-plugin-wkwebviewxhrfix
Upvotes: 3