Search code examples
cordovaionic3cordova-ios

How to fix UIWebView deprecated Ionic 3


After getting a message from apple regarding UIWebView

ITMS-90809: Deprecated API Usage – Apple will stop accepting submissions of apps that use UIWebView APIs. See https://developer.apple.com/documentation/uikit/uiwebview for more information.

To fix it have updated Cordova 10 and cordova-ios 6.1.1. which fixed most of UIWebView references in the IOS platform but still it's showing few references in the core package (I guess)

enter image description here

Can anyone please help how I can fix remain UIWebView references?

I am using cordova: 10.0.0 / ionic: 3.9.2 / cordova-ios: 6.1.1


Solution

  • The UIWebView string matches in you screenshot refer to vendor.js. These do not matter as Apple only cares about the native (Objective-C/Swift) code of your app referring to UIWebView.

    To search only source files of a relevant filetype, try this:

    grep -inr --include \*.h --include \*.m --include \*.swift UIWebView platforms/ios
    

    If this returns no results, your app's source code is free of UIWebView references.

    However, if you still get the ITMS-90809 warning when you upload your binary to App Store Connect, it may be because the plugins in your Cordova app include/depend on 3rd party frameworks which reference UIWebView. You can also check for this as outlined here but the process it slightly trickier:

    • Archive your app in Xcode
    • Right-click on it in the Organizer window and Show in Finder
    • Then right-click on the .xcarchive and Show Package Contents
    • Open a Terminal window at this location and navigate to Products/Applications/MyAppName.app
    • Then run the following command to scan the Frameworks included in your app for UIWebView references:
        for framework in Frameworks/*.framework; do
          fname=$(basename $framework .framework)
          nm $framework/$fname | grep UIWebView
        done
    

    If there are any matches, you'll need to find which Cordova plugin incldues that Framework. Then either update the plugin version to one which includes a new Framework version that doesn't use UIWebView or if one doesn't exist, raise an issue against the plugin, fix it yourself and raise a PR or if all else fails, remove that plugin from your Cordova app.