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

UIWebView Deprecation warning by Apple #398

Closed
JoshuvaGeorge03 opened this issue Mar 26, 2020 · 9 comments
Closed

UIWebView Deprecation warning by Apple #398

JoshuvaGeorge03 opened this issue Mar 26, 2020 · 9 comments
Assignees

Comments

@JoshuvaGeorge03
Copy link

JoshuvaGeorge03 commented Mar 26, 2020

Thanks for the wonderful plugin.

Please refer below. According to apple, When the app contains a reference to UIWebView, they won't allow permission into AppStore. I have found out phonegap-nfc has a reference to UIWebView. Please advise, what to do to fix this issue?

If your app still embeds web content using 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. And it’s supported in iOS and macOS, and by Mac Catalyst.

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

(https://developer.apple.com/news/?id=12232019b)

@tzeroem
Copy link

tzeroem commented Apr 2, 2020

This plugin supports WKWebView.

  dispatch_async(dispatch_get_main_queue(), ^{
        if ([[self webView] isKindOfClass:WKWebView.class])
          [(WKWebView*)[self webView] evaluateJavaScript:function completionHandler:^(id result, NSError *error) {}];
        else
          [(UIWebView*)[self webView] stringByEvaluatingJavaScriptFromString: function];
    });

I think you should remove UIWebView instance from NfcPlugin.m in ios folder

@don
Copy link
Member

don commented Apr 8, 2020

@JoshuvaGeorge03 your app got rejected because of this? It's a conditional reference that can probably be removed like @tzeroem suggests.

@don don self-assigned this Apr 8, 2020
@JoshuvaGeorge03
Copy link
Author

@don Could you please advise how to use WKWebView in PhoneGap-NFC?

@JoshuvaGeorge03
Copy link
Author

@tzeroem Could you please say how to remove UIWebView instance from NfcPlugin.m? Please advice.

@don
Copy link
Member

don commented Apr 9, 2020

@JoshuvaGeorge03 newer versions of Cordova/PhoneGap should use WKWebView

The ObjectiveC code in the plugin needs to execute some Javascript in the UI. This code checks to see if your app is using UIWebView or WKWebView and calls the function on the correct one.

dispatch_async(dispatch_get_main_queue(), ^{
if ([[self webView] isKindOfClass:WKWebView.class])
[(WKWebView*)[self webView] evaluateJavaScript:function completionHandler:^(id result, NSError *error) {}];
else
[(UIWebView*)[self webView] stringByEvaluatingJavaScriptFromString: function];
});

I don't want to remove that code immediately because it will break older apps. If your app was rejected by Apple because of this UIWebView let me know and I'll bump up the priority on this fix.

@JoshuvaGeorge03
Copy link
Author

@don I have got a warning message from apple for now. But it should be done for every app I think. Because apple will stop accepting apps with UIWebView reference from December 2020.

Please check this link for more info

https://developer.apple.com/news/?id=12232019b

@don
Copy link
Member

don commented Apr 11, 2020

@JoshuvaGeorge03 this is just a warning. Ignore it for now. The next release will fix it.

@JoshuvaGeorge03
Copy link
Author

@don Thanks, keenly waiting for that

@don
Copy link
Member

don commented Apr 16, 2020

PR #399 removed UIWebView. Changes published in phonegap-nfc-1.1.0.

@don don closed this as completed Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants