Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all UIWebView code? #661

Closed
jcesarmobile opened this issue Aug 29, 2019 · 108 comments · Fixed by #773
Closed

Remove all UIWebView code? #661

jcesarmobile opened this issue Aug 29, 2019 · 108 comments · Fixed by #773

Comments

@jcesarmobile
Copy link
Member

jcesarmobile commented Aug 29, 2019

People has started receiving this warning when submitting apps that have references to UIWebView.

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs.

Doesn't matter if they are using just WKWebView, as long as Apple sees "UIWebView" in the app code, they show the warning, and cordova-ios is full of "UIWebView" references. (Even react native, flutter and Capacitor users have received the warning)

There is currently no solution to this problem for Cordova apps.

So, instead of integrating WKWebView and making it possible to switch from UIWebView to WKWebView on runtime as it was planned, maybe we should just remove all UIWebView code on next major release?

There is no deadline, I've contacted an Apple developer that has been tweeting about moving to WKWebView to see if he can provide more information, will update if I get a response.

Apple finally announced the deadline:

The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.

@jcesarmobile jcesarmobile changed the title Remove al UIWebView code? Remove all UIWebView code? Aug 29, 2019
@fjaeger
Copy link

fjaeger commented Aug 29, 2019

I am not sure whether it is necessary to remove all the references to UIWebView. There is even some UIWebView code being executed when WKWebView is configured as the main engine. I know at least of CDVUserAgentUtil that is still using UIWebView – independent of the engine configuration.

@eun-choi
Copy link

eun-choi commented Aug 30, 2019

It's very important issue in the near future, because UIWebView been deprecated on iOS 13.
That means we would be rejected by App Store Review at some point in the near future.

https://developer.apple.com/documentation/uikit/uiwebview

@janpio
Copy link
Member

janpio commented Aug 30, 2019

It's very important issue in the near future, because UIWebView been deprecated on iOS 13.
That means we would be rejected by App Store Review at some point in the near future.

That is fortunately not true. Things can be deprecated for a long time before they are removed or their usage affect App Store review.

Which of course does not mean that the previously posted thoughts are wrong in any way - it just doesn't mean this has to lead to problems in the near future. It just definitely could.

@nijakobius
Copy link

It's very important issue in the near future, because UIWebView been deprecated on iOS 13.
That means we would be rejected by App Store Review at some point in the near future.

That is fortunately not true. Things can be deprecated for a long time before they are removed or their usage affect App Store review.

Which of course does not mean that the previously posted thoughts are wrong in any way - it just doesn't mean this has to lead to problems in the near future. It just definitely could.

UIWebView has been deprecated for well over a year though, so I fear the "long time" is coming to an end very soon. So I'd second that this is a rather urgent issue.

Here's a Twitter thread from one Apple dev on the topic:
https://twitter.com/NiklasMaerz/status/1167031874738434048

@dpogue
Copy link
Member

dpogue commented Aug 30, 2019

Just to set expectations: There's probably about 1 week of full-time work to be done by somebody familiar with the cordova-ios and WKWebView plugin codebases to resolve this issue.

There is currently nobody working full-time on Cordova. We are all volunteers with limited time to contribute.

@derman10
Copy link

Same email from Apple to uploading my app to TestFight.

Im building iOS app from ionic 3/cordova and not use UIWebView, just WebView on my config.xml.

<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />

Any Solution??

@jcesarmobile
Copy link
Member Author

Apple warns because cordova-ios has the UIWebView code, doesn't matter if you use it or not, the code is there.

But it's a warning, we don't know for sure how long will take until Apple starts rejecting apps because of that.

Once they start rejecting apps, the only solution will be to update your cordova-ios version and all plugins that have references to UIWebView to newer versions that don't have those references (they don't exist yet, that's what this issue is for).

@fjaeger
Copy link

fjaeger commented Aug 30, 2019

I created a compile-time decision for WKWebView over UIWebView in Pull Request #662

@spinninghamster
Copy link

spinninghamster commented Aug 31, 2019

iOS 13 will be released around 17 September 2019. Could be that Apple will start rejecting apps after that date.

Starting which version of cordova-ios is WKWevView being used as the default engine? I hear that UIWebView is not being used anymore and WKWebView is the default (but there are still traces of UIWebView), but since which version has this started?

@dpogue
Copy link
Member

dpogue commented Aug 31, 2019

Apple is not going to start rejecting apps that use UIWebView with less than a month of notice. For the moment, it is safe to ignore the warning.

No version of cordova-ios uses WKWebView by default.

@spinninghamster
Copy link

Apple is not going to start rejecting apps that use UIWebView with less than a month of notice. For the moment, it is safe to ignore the warning.

No version of cordova-ios uses WKWebView by default.

That's somewhat good news.

I was referring to this: https://twitter.com/NiklasMaerz/status/1167031874738434048 where Niklas wrote:

WKWebView is a plugin and UIWebView is part of the core platform. This means we only use WKWebView but there are still unused references of UIWebView in code.

I thought he was speaking about Cordova; but maybe he was speaking about a specific own app.

@NiklasMerz
Copy link
Member

NiklasMerz commented Aug 31, 2019 via email

@fabuhelow
Copy link

Same email from Apple to uploading my app to TestFight.

Im building iOS app from ionic 3/cordova and not use UIWebView, just WebView on my config.xml.

<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />

Any Solution??

Please follow the following link which will help you to move from UIwebview to WKwebview

https://ionicframework.com/docs/v3/wkwebview/

@spinninghamster
Copy link

When cordova-ios migrates from UIWebView to WKWebView, how will LocalStorage in apps be handled? Will there be a way to migrate them over?

@timbru31
Copy link
Member

timbru31 commented Sep 1, 2019

That's a good question @spinninghamster! One could argue that a breaking change means no transition of user data, since e.g. plugins for LocalStorage and IndexedDB already exist (e.g., https://github.com/maklesoft/cordova-plugin-migrate-localstorage & https://github.com/pointmanhq/cordova-plugin-ionic-migrate-storage

@EdwinRozario
Copy link

EdwinRozario commented Sep 1, 2019

@fabuhelow Did that solution work for you? My project is running on Ionic 5.1.0. By default its should be using WKWebView. Still receiving the warning. I have tried upgrading to the latest version of cordova-plugin-ionic-webview which is 4.1.1 & updated the config.xml as suggested with no success.

I dont think this issue is due to the app using UIWebview. Any reference of it in any Cordova plugins are causing these warnings. I hope we will be resolved or someone will give us an idea of when it will be resolved.

I have a product release in early October 😞

@sts-ryan-holton
Copy link

sts-ryan-holton commented Sep 3, 2019

I'd strongly consider prepping some time for this issue, what we don't want is it to suddenly become depreciated upon a later iOS 13 release and then the apps suddenly can't be built, if it's true that it'll take the best part of a week to fix, let's ensure backwards compatibility with older versions of Cordova and ensure that it can truly be fixed promptly when it happens.

I'd further suggest pinning this issue to your repo.

@bpresles
Copy link

bpresles commented Sep 3, 2019

@sts-ryan-holton I've worked already on fixing this potential issue. See PR #663.

@EdwinRozario
Copy link

Thanks @bpresles . For us working with Ionic, we will to wait for the Ionic team to upgrade cordova-ios in cordova-plugin-ionic-webview before we can start testing this.

@janpio
Copy link
Member

janpio commented Sep 3, 2019

For us working with Ionic, we will to wait for the Ionic team to upgrade cordova-ios in cordova-plugin-ionic-webview before we can start testing this.

This doesn't make sense. You install cordova-ios into your Cordova app that uses Ionic, but the Cordova iOS version is not set by Ionic and definitely not by cordova-plugin-ionic-webview.

@EdwinRozario
Copy link

Yes. But cordova-plugin-ionic-webview has a cordova-ios dependency. I thought the plan was to get rid of any reference of UIWebView from project. If simply updating cordova-ios will fix the issue, i will be more than happy.

@RichardBoyder
Copy link

Hi guys. A Strange Question I know in this forum.. But Are most people moving over to capacitor? Is it Safe to say that the developers who were focusing more on Cordova has taken a slightly different focus? OR Are we Still very serious about Cordova and its future? (Given Apple issues with soon to be deprecated UiWebView.)

This isn't to blame the developers at all , Cordova is brilliant, Its just a simple question Since I now have to make a decision to leave Cordova and go with Capacitor that Ionic has introduced Since Apple Store issue. Business is pushing so its either or ... And I hate to leave Cordova since it has sooooo many awesome plugins and I have built my custom plugin for it which is working wonders.

@suraneti
Copy link

suraneti commented Dec 3, 2019

@RichardBoyder I'm not sure about Capacitor but for Cordova right now is driven by the community.

@RichardBoyder
Copy link

@RichardBoyder I'm not sure about Capacitor but for Cordova right now is driven by the community.

Understood. Thanks for the reply.

@EiyuuZack
Copy link

@RichardBoyder I'm not sure about Capacitor but for Cordova right now is driven by the community.

@suraneti what exactly do you mean by this? Does Apache no longer have anything to do with Cordova?

@NiklasMerz
Copy link
Member

@RichardBoyder I'm not sure about Capacitor but for Cordova right now is driven by the community.

@suraneti what exactly do you mean by this? Does Apache no longer have anything to do with Cordova?

I don't think this is the right place to discuss the Cordova vs Capacitor topic, since this is about an important Cordova issue to be discussed.

I would like to add a short personal note about that nevertheless:

Cordova still an active Apache project worth investing in. It's maintained by volunteers, but probably @suraneti is meaning that nobody is paid to work full-time on Cordova. This means (to me) you may need to be more patient and open to fixing issues and contributing yourself.

@RichardBoyder
Copy link

All understood. We seriously need a fix for Cordova so we don't have issues when apple decides to cancel our binary uploads. So a very serious matter.

Anyone who can comment and perhaps We can make a path to get it sorted so we don't have to worry about our Cordova apps being rejected in future.. its kind of unnecessary stress on us developers now and I really hope anyone who has Power here to fix this for us will look seriously at this issue. Please need a answer. Will we be able to rest in the knowledge that this will be sorted within next 2 months or so... ? I'm asking the Cordova Devs here who can do it and who can push a new major version of Cordova so we can all implement this?

@RichardBoyder
Copy link

@RichardBoyder I'm not sure about Capacitor but for Cordova right now is driven by the community.

@suraneti what exactly do you mean by this? Does Apache no longer have anything to do with Cordova?

I don't think this is the right place to discuss the Cordova vs Capacitor topic, since this is about an important Cordova issue to be discussed.

I would like to add a short personal note about that nevertheless:

Cordova still an active Apache project worth investing in. It's maintained by volunteers, but probably @suraneti is meaning that nobody is paid to work full-time on Cordova. This means (to me) you may need to be more patient and open to fixing issues and contributing yourself.

I wish I had the skills to fix this haha (I don't) ... otherwise I would be doing it right now... So many hundreds of people are relying on Cordova for their apps on store and I'm sure everyone is worried.

@spinninghamster
Copy link

All understood. We seriously need a fix for Cordova so we don't have issues when apple decides to cancel our binary uploads. So a very serious matter.

Anyone who can comment and perhaps We can make a path to get it sorted so we don't have to worry about our Cordova apps being rejected in future.. its kind of unnecessary stress on us developers now and I really hope anyone who has Power here to fix this for us will look seriously at this issue. Please need a answer. Will we be able to rest in the knowledge that this will be sorted within next 2 months or so... ? I'm asking the Cordova Devs here who can do it and who can push a new major version of Cordova so we can all implement this?

It has already been fixed. Read:
https://cordova.apache.org/announcements/2019/11/25/cordova-ios-release-5.1.0.html

@RichardBoyder
Copy link

RichardBoyder commented Dec 11, 2019

Unfortunately not (well it didn't work for me at least ). Moved to 5.1.0 ages ago when it came out and still get the apple warning. did everything recommended there and its still happening when push to store.

@breautek
Copy link
Contributor

Unfortunately not. Moved to 5.1.0 ages ago when it came out and still get the apple warning. did everything recommended there and its still happening when push to store.

Then you likely have a plugin that still references UIWebview api. A common one that I can think of is the inappbrowser plugin. So I would inspect your plugins.

@RichardBoyder
Copy link

Unfortunately not. Moved to 5.1.0 ages ago when it came out and still get the apple warning. did everything recommended there and its still happening when push to store.

Then you likely have a plugin that still references UIWebview api. A common one that I can think of is the inappbrowser plugin. So I would inspect your plugins.

That is very true. Could be the case. I guess the plugin authors haven't updated their plugins yet to sort this out. But could certainly find and comment out I guess in the interim ... if it doesn't break the app.

@jacobweber
Copy link

OK, the deadline is upon us:

The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.

@spinninghamster
Copy link

OK, the deadline is upon us:

The App Store will no longer accept new apps using UIWebView as of April 2020 and app updates using UIWebView as of December 2020.

Now: "Oh, a year of time ..all good"

In November 2020: "Oh my god, we're running out of time! The 10 most popular Cordova plugins are all not updated yet!"

@desmeit
Copy link

desmeit commented Dec 27, 2019

@breautek Is there a way to search the plugins to find UIWebview api? What is the exact keyword? Just "UIWebview"? I think it is just a problem with the 3.1.0 version of inappbrowser plugin.

@desmeit
Copy link

desmeit commented Feb 28, 2020

In my case the following plugins caused the issue:

facebook4 3.1.0
Googleplus 7.0.1
cordova-plugin-decimal-keyboard

i tested it step by step. delete plugin by plugin one after the other until the message disappears. not nice, but I couldn't find out otherwise.

@JamesCoyle
Copy link

I've recently created a new Cordova project specifically for iOS and I'm getting this issue. I'm using cordova-ios v5.1.1 and the only plugin I'm using is cordova-plugin-whitelist v1.3.4. What can I do about this?

@breautek
Copy link
Contributor

breautek commented Mar 3, 2020

I've recently created a new Cordova project specifically for iOS and I'm getting this issue. I'm using cordova-ios v5.1.1 and the only plugin I'm using is cordova-plugin-whitelist v1.3.4. What can I do about this?

Add a wkwebview plugin such as this one.

Do pay attention to the required config.xml settings.

Do note that plugin is a stopgap, it won't be needed in the next major release of cordova-ios, which will only support wkwebview, and it will be built-in.

If you have any further questions, don't be afraid to drop by our slack

@KevinKelchen
Copy link

I want to give a big THANK YOU to ALL of the contributors (@erisu, @jcesarmobile, etc.) who have helped in any way to add the feature that removes UIWebView references at compile-time.

Just this past week we began receiving emails from Apple about our existing app having UIWebView references even though we were using WKWebView to host our app. We were able to make a small version bump to cordova-ios and opt-in with the new flag and it worked beautifully! No more emails from Apple!

FWIW, these are the plugins we have in our project:

"plugins": {
  "cordova-plugin-cartegraph-datepicker": {},
  "cordova-plugin-device": {},
  "cordova-plugin-safariviewcontroller": {},
  "cordova-plugin-whitelist": {},
  "cordova-plugin-screen-orientation": {},
  "cordova-plugin-splashscreen": {},
  "cordova-plugin-statusbar": {},
  "cordova-sqlite-ext": {},
  "cordova-plugin-network-information": {},
  "cordova-plugin-geolocation": {},
  "cordova.plugins.diagnostic": {
    "ANDROID_SUPPORT_VERSION": "26.+"
  },
  "cordova-plugin-camera": {},
  "com-sarriaroman-photoviewer": {},
  "cordova-plugin-image-resizer": {},
  "cordova-plugin-customurlscheme": {
    "URL_SCHEME": "cgone",
    "ANDROID_SCHEME": " ",
    "ANDROID_HOST": " ",
    "ANDROID_PATHPREFIX": "/"
  },
  "cordova-plugin-ionic-keyboard": {},
  "cordova-ios-plugin-no-export-compliance": {},
  "cordova-plugin-ionic-webview": {
    "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
  },
  "cordova-plugin-wkwebview-inject-cookie": {},
  "cordova-plugin-cartegraph-cookie-master": {}
}

I appreciate the volunteer work of Cordova maintainers and contributors who spend personal time outside of their day jobs to help keep things running smoothly for us! ❤️

@khayargoli
Copy link

khayargoli commented Mar 10, 2020

@KevinKelchen Does this mean that anyone using cordova-ios: 5.1.1 and usage of latest plugins will be able to pass app submission sucessfully? Don't we have to remove UIWebView instances manually?

@KevinKelchen
Copy link

@Biswas123, using cordova-ios 5.1.1 and the new flag will remove UIWebView references automatically for you at compile-time, but it's just those UIWebView references that are part of cordova-ios.

If you use other plugins that themselves reference UIWebView, removing those UIWebView references has to be addressed separately by those plugins; updating cordova-ios and using the new flag will not inherently remove those references.

We did not have any plugins that referenced UIWebView so updating cordova-ios was all that was necessary for us to pass app validation successfully.

@mcastets
Copy link

mcastets commented Mar 11, 2020

Does anyone know how to check if a build still reference UIWebView like Apple do?

I have tried to unzip my Appname.ipa file then run grep -lr "UIWebView" *.
It returns a line like Payload/MyApp.app/MyApp. Does it mean my build won't pass Apple check?

Even better, how to know which plugins still reference UIWebView?

@KevinKelchen
Copy link

I don't know enough to comment on analyzing the app binary to know whether it will contain UIWebView usages that Apple won't like.

As far as plugins go, you could search the plugins directory of your repo after a cordova prepare to see if any plugins use UIWebView.

Otherwise you could try uploading your build to Apple TestFlight.

At least for us, we started receiving an email from Apple with every single upload to TestFlight. After we updated cordova-ios and used the new flag those emails completely went away. That was good enough evidence for us.

If you're not using TestFlight or you're not already getting emails from Apple about UIWebView from your uploads to TestFlight, this technique may not work well. But the "proof in the pudding" of whether your app contains any UIWebView-related stuff Apple wouldn't like is to actually run it through Apple's validation and see if it gets flagged (upload to TestFlight or submit the app to the App Store).

@nulele
Copy link

nulele commented Mar 16, 2020

I don't know enough to comment on analyzing the app binary to know whether it will contain UIWebView usages that Apple won't like.

As far as plugins go, you could search the plugins directory of your repo after a cordova prepare to see if any plugins use UIWebView.

Otherwise you could try uploading your build to Apple TestFlight.

At least for us, we started receiving an email from Apple with every single upload to TestFlight. After we updated cordova-ios and used the new flag those emails completely went away. That was good enough evidence for us.

If you're not using TestFlight or you're not already getting emails from Apple about UIWebView from your uploads to TestFlight, this technique may not work well. But the "proof in the pudding" of whether your app contains any UIWebView-related stuff Apple wouldn't like is to actually run it through Apple's validation and see if it gets flagged (upload to TestFlight or submit the app to the App Store).

Same problem.
Sorry @KevinKelchen but I don't understand what "flag" are you talking about... where do I have to opt-in that flag?

And this solution works for "cordova-plugin-ionic-webview" too or only "for cordova-plugin-wkwebview-engine"? I have installed the first.

Thanks

@erisu
Copy link
Member

erisu commented Mar 16, 2020

  • Use cordova-ios@5.1.1
  • Add preference flag WKWebViewOnly to the config.xml.

Must use a WKWebView plugin.
The following example uses the cordova-plugin-wkwebview-engine plugin:

  • Add plugin cordova-plugin-wkwebview-engine, preferably the latest version 1.2.1
  • Add preference attribute CordovaWebViewEngine to the config.xml.
  • Add feature attribute CDVWKWebViewEngine to the config.xml.

Example config.xml with cordova-plugin-wkwebview-engine plugin

<platform name="ios">
    <preference name="WKWebViewOnly" value="true" />

    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />
    </feature>

    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
</platform>

Still getting the warning?
If you are still getting the warning, most likely a plugin that you are using still references UIWebView. You will need to identify which plugin and contact the plugin developers on their support channel (plugin's repo) and request them to fix it. They can either remove the references or make use of this flag to wrap the references.

All official Cordova plugins were updated to use the flag.

Using Ionic WKWebView plugin?
If you are using Ionic's plugin, I believe the UIWebView references have already been removed from their latest version.

  • Make sure you are using the latest version.
  • Make sure the WKWebViewOnly flag is set still for cordova-ios platform.

The other preference and feature arguments seen in the example above are from cordova-plugin-wkwebview-engine and may not be needed for Ionic.

If you have any issue or usage questions with the Ionic plugin. Read their docs and request help from their support channels.

@apache apache locked as resolved and limited conversation to collaborators Mar 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet