Discontinuation of UIWebView and its implication on MobileFirst apps

UIWebView is by Apple since June 2018. However, this recent announcement by Apple brings an end to the use of UIWebView in all iOS apps.

Important: If your app still embeds web content that uses the deprecated UIWebView API, we strongly encourage you to update to WKWebView, as soon as possible, for improved security and reliability. WKWebView ensures that compromised web content doesn’t affect the rest of an app by limiting web processing to the app’s web view. It is supported in iOS and macOS, and by Mac Catalyst.

Note: The App Store will no longer accept new apps that use UIWebView as of April 2020 and app updates that use UIWebView as of December 2020.

Since iOS 12, Apple began warning developers about migrating to WKWebView, UIWebView’s successor. Since last year, the warning ITMS-90809: UIWebView API Deprecation was seen during app submission, if the app used UIWebview.

The message that you see while you upload app that uses UIWebview is as below.

We identified one or more issues with a recent delivery for your app, [App Name & version number]. Your delivery was successful, but you might want to correct the following issues in your next delivery:

ITMS-90809: Deprecated API Usage – Apple will stop accepting submissions of apps that use UIWebView APIs. See here, for more information.

After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to App Store Connect.

Upon app submission, Apple searches the app’s code for the “UIWebView” string then generates a submission warning if found. Therefore, a future release of MobileFirst based apps is required to ensure that all references to UIWebView APIs are removed.

What should you do

We recommend all developers to update their apps. Apple will only accept submissions of iOS apps that contain references to UIWebView until April 2020 (for new apps) and until December 2020 (for existing apps). To meet the new requirement, upgrade your MobileFirst SDK to iFix 8.0.0.0-IF202001211306.

If you want to update from cocopod, add pod 'IBMMobileFirstPlatformFoundation' '~>8.0.2020011414' to your podfile.

If you’re using Cordova, see below.

Enabling WkWebview for Cordova/Ionic apps

The Cordova community released Cordova iOS 5.1.0, which disables UIWebview at compile time. To disable UIWebview with MFP cordova app, use following steps.

  1. Upgrade cordova-plugin-mfp to version 8.0.2020012010. Ensure you have a WKWebView plugin that is installed, either the official Apache one or Ionic’s.

  2. Add following lines to your config.xml file.

       <preference name="WKWebViewOnly" value="true" /> 
    
  3. Also, make sure that your Xcode project has Build setting -> User Defined setting WK_WEB_VIEW_ONLY set to 1 as below.

    Xcode User Defined Options

  4. Run cordova prepare ios to apply the changes.

  5. Link webkit.framework to your app in Build Phases of your project in Xcode as below.

    Xcode Build Phases

Note:

  • Ensure that other Cordova plug-ins that might be using UIWebView are also updated to remove references to UIWebView. For example, InAppBrowser plugin, The Cordova team released an update in January 2020. Be sure to update this plug-in to version 3.2.0 and above.

  • If you are using MobileFirst v7.1, then read the blog to learn about MobileFirst v7.1 support for the above App Store restriction.

  • Cordova has not removed CDVUIWebViewEngine intentionally because it is still using compiler directive WK_WEB_VIEW_ONLY to enable and disable WKWebView. Therefore, you might still see a warning from Apple while publishing. You might have to remove CDVUIWebViewEngine manually if you are not using it.
  • Add cordova-plugin-wkwebviewxhrfix plug-in while using cordova-plugin-wkwebview-engine to get rid of CORS issue while using Direct Update.

Update

We have recently fixed the following issue, which is seen only after we replace WKWebview with UIWebview in our MFP cordova plugin.

PH25696 FAIL TO LOAD VIEW AFTER DIRECT UPDATE ON IOS 12 USING WKWEBVIEW

We introduced the fix to circumvent a known iOS issue where app fails to reload after Direct Update due to file permission. The issue is fixed in iOS 13 and seen on only older iOS versions.

We also introduced the following fixes in our plugin in order to address user experience concerns post WKWebview migration.

  • PH24759 DIRECT UPDATE PROGRESS BAR REMAINS STUCK DURING DIRECT UPDATE ON WKWEBVIEW
  • PH26880 FIX IN ERROR HANDLING FOR DIRECT UPDATE USING WKWEBVIEW

We recommend customers to migrate to cordova-plugin-mfp version 8.0.2020070310 if they are using cordova-ios 5.1.1 with WkWebview.

Last modified on July 08, 2020