NeutrinosPlatform / cordova-plugin-mobile-ocr

A cordova plugin that can accept image URI or Base64 data and returns the text present in the image as string without need for network. You can also try :- https://github.com/NeutrinosPlatform/cordova-plugin-ml-text
MIT License
49 stars 30 forks source link

Google Mobile Vision relying on deprecated UIWebview #27

Open thmclellan opened 4 years ago

thmclellan commented 4 years ago

Using this plugin on a Capacitor project, I'm running into an Apple testflight warning that we're using UIWebView (ITMS-90809: Deprecated API Usage — Apple will stop accepting submissions of apps that use UIWebView APIs).

Doing a search for UIWebview references, it seems that the GoogleMobileVision pod is still referencing UIWebview, which may be triggering the error from Apple.

Related issue: https://github.com/firebase/quickstart-ios/issues/788

Is this a known issue for this plugin and something that might be addressed in the future? It's an impressive OCR experience so just wondering if it can work without any UIWebView issues. Thanks

thmclellan commented 4 years ago

Apple has announced they'll no longer accept new apps with UIWebview in April 2020 and no more app updates in December 2020. @ChrisTomAlx are you still maintaining this plugin for iOS or is it only for Android? I saw you also created https://github.com/NeutrinosPlatform/cordova-plugin-ml-text and wondered if that fixes the UIWebview issue. Thanks

ChrisTomAlx commented 4 years ago

Hey @thmclellan Could you see if the new cordova-ios 5.1.0 fixes this issue? Using the solution here :- https://github.com/apache/cordova-ios/pull/715

Basically add the following line to your config.xml <preference name="WKWebViewOnly" value="true" /> it should disable all UIWebView compilations.

I am on a slightly heavy schedule now, so if you would be kind enough to test it out that would be amazing. Will get on this as soon as I am able to if this does not pan out for you.

Cheers, Chris Neutrinos

thmclellan commented 4 years ago

Thanks @ChrisTomAlx for clarifying. We're actually running the plugin on a project with Capacitor, Ionic's alternative to Cordova, and it's only using WKWebview. Even with that setup, we're still getting the UIWebView deprecation error from Apple. When grepping the project, it looks like the UIWebView reference is coming from the Google Mobile Vision framework.

Unfortunately Google isn't planning to update that framework (which seems to be closed source), but it looks like their Firebase MLKit solves for the UIWebView issue and is WKWebview only. I wondered about maybe swapping out the Google Mobile Vision framework for Firebase. They have a good example at https://firebase.google.com/docs/ml-kit/ios/recognize-text.

Also on a tight delivery schedule so not sure when / if I'll get a chance to try this, but sharing these findings in case others run into the same issue.

Cheers, Tom

ChrisTomAlx commented 4 years ago

The cordova-plugin-ml-text plugin was created to address this exact issue, if and when Google decides to throw away the original library. But the plugin is a bit dated and hasn't been tested in a while. If UIWebView is a big blocker for you, Using the ml-text plugin is your best bet. You can raise issues for that plugin here

Cheers, Chris Neutrinos

thmclellan commented 4 years ago

Thanks Chris, appreciate the background, we'll give that a try. Cheers, Tom

ceroideas commented 4 years ago

Hi, can anyone be so kind as to show me how to install this plugin in ionic? (cordova-plugin-ml-text), thank you very much in advance

Polm90 commented 4 years ago

I'm not receiving the warning anymore since a couple of weeks... Maybe did Google update pods?

ChrisTomAlx commented 4 years ago

@Polm90 Are you sure? You are talking about iOS itself right? I don't see a new pod as such but maybe its one of the internal dependencies that changed. Re-opening this issue because I am sure a lot of people might be wondering about this. If anyone gets this into app store when pushing a new app let us know. Thanks. This is not applicable to updating an older version of the app on app store - updates will only be blocked from December if I remember correctly.

Cheers, Chris Neutrinos

Polm90 commented 4 years ago

@Polm90 Are you sure? You are talking about iOS itself right? I don't see a new pod as such but maybe its one of the internal dependencies that changed. Re-opening this issue because I am sure a lot of people might be wondering about this. If anyone gets this into app store when pushing a new app let us know. Thanks. This is not applicable to updating an older version of the app on app store - updates will only be blocked from December if I remember correctly.

Cheers, Chris Neutrinos

I do not know what changed...and I did not checked if Google has changed something... But I currently have an app on the AppStore which uses this plugin. In the last months, everytime I've uploaded an update on Testflight I've received the warning mail from Apple saying that I was using a deprecated API and from december 2020 I wouldn't be able to upload new binaries. I've received the last mail of this kind in september. In the last 2 weeks I've uploaded many new binaries on TestFlight but I've never recevied this warning mail anymore... So I wanted just inform about this new behaviour...

ChrisTomAlx commented 4 years ago

That is really strange @Polm90. I will keep the issue open for now. Please update us if the behavior changes in some way or you figure out why the sudden change in behavior. Would really appreciate it. Thank you

Cheers, Chris Neutrinos

Flofie commented 3 years ago

I can confirm that despite not getting an Email the issue still persists. If you create a new app on the appstore and deploy an app with cordova-plugin-mobile-ocr the app gets rejected by "Deprecated API use"

ChrisTomAlx commented 3 years ago

Yea it seems apple has started rejecting UIWebView app updates again. I think this is a good time to switch to the ml-text plugin . Releasing a new update today that adds the foundText key so the output of both the plugins should be almost identical, thereby reducing the amount of code changes that will be required.

Cheers, Chris Neutrinos

jfoclpf commented 3 years ago

I can also confirm that Apple rejects this plugin. Furthermore this plugin makes the build crash upon cordova build ios. I strongly recommend you to stop support for ios (at least temporarily) because Cordova CLI does not allow developers to install plugins only in a specific platform and this plugin still does work perfectly in Android.

Therefore I recommend you to remove <platform name="ios"> from plugin.xml. Otherwise you may see developers uninstalling this plugin altogether.

ChrisTomAlx commented 3 years ago

@jfoclpf Have you tried the ml-text plugin ? Will be deprecating this plugin soon in its entirety, since there is no need for two plugins that do the same thing

Cheers, Chris Neutrinos

jfoclpf commented 3 years ago

Hi @ChrisTomAlx once I tried that plugin and I got similar errors while building. Anyway there's no need to deprecate this plugin because insofar it works perfectly in Android.

Just remove references to ios in plugin.xml with a note in readme that it is only supported in Android. If you want I can do a PR with such amendment.

jfoclpf commented 3 years ago

@ChrisTomAlx I made a fork of this plugin and made these commits, now it's working like a charm :)

hpvaghani commented 3 years ago

@jfoclpf Have you tried the ml-text plugin ? Will be deprecating this plugin soon in its entirety, since there is no need for two plugins that do the same thing

Cheers, Chris Neutrinos

Hi,

Plugin seems to be for cordova only, there is no support for ionic2+(no node modules). Please share resolution/work around for same if found as i had to remove plugin for iOS build bcuz non of the above solutions worked and kept giving same deprecation error for iOS build.

Thanks in advance.

kstolk commented 3 years ago

Anyone still active on this plugin? Kind of lost for use in ionic for text recognition.

jfoclpf commented 3 years ago

@Cyw00d i use this plugin in cordova and it works well

mark-baumann commented 1 year ago

Yes but you can´t publish your app to the app store?

jfoclpf commented 1 year ago

of course you can, I do it in my cordova apps

mark-baumann commented 1 year ago

have you got a example? I am looking how i can do ocr in cordova / capacitor apps Is it possible to run it in the browser?