Apple Says “No” to UIWebView, Ionic Counters with Capacitor

by 

| November 5, 2019 | in

Apple continually updates its products and technologies. While that’s usually a thing to relish, it sometimes comes at a cost.

One such recent change is the UIWebView component. Apple has warned developers that UIWebView is deprecated, and at some point, they will stop allowing app store submissions for applications that use it. If you need a web browser in your application, you can use WKWebView instead.

This deprecation of UIWebView means Cordova applications will soon have problems getting approved by Apple. Ionic mobile apps are also affected by this.

But Ionic applications have a path forward by leveraging Ionic’s Capacitor framework instead of Cordova. Capacitor uses WKWebView on iOS.

Capacitor supports iOS and Android, but it also supports PWAs and Electron. It also provides a nice bridge from Ionic to other platforms. Unfortunately, switching over to using Capacitor requires some work.

How to Upgrade

  1. Open your Ionic project.
  2. Install capacitor: npm install –save @capacitor/core @capacitor/cli
  3. Initialize capacitor: npx cap init
  4. Add platforms: npx cap add ios

You can build your Ionic project and then run “npx cap copy” to push your changes into your iOS project in Xcode.

ionic build
npx cap copy

Problems You May Run Into

You could run into problems when building on your iOS app. You might get a weird error like “Unknown installation options: disable_input_output_paths”. If you see this, you will need to update your CocoaPods.

gem install cocoapods -n /usr/local/bin

Don’t be surprised if your Xcode build doesn’t work right away. You may get an error like “NSDictionary+CordovaPreferences.h: No such file or directory”. If so, you have some more work ahead of you. The Developer workflow has changed and you don’t have everything there yet. Review the Capacitor Workflow page for more information.

What about my icons? After setting up your project for Capacitor, you will have lost all your icons in Xcode. The easiest solution here is to copy them to your new project from your previous iOS project (platforms/ios).

Don’t Be Frustrated – Updates Are Part of the Process

These sorts of required changes (removal of UIWebView) happen in software development. There is almost no software that won’t have to be updated to keep it running smoothly. The key isn’t to get too worked up about it; this is just part of the game. Probably the biggest thing to keep in mind is almost every year you will have to invest something into keeping your software running.

author avatar
Chad Michel Senior Software Architect
Chad is a lifelong Nebraskan. He grew up in rural Nebraska and now lives in Lincoln. Chad and his wife have a son and daughter.

Related posts