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 deprecated UIWebView #308

Closed
goelay opened this issue Aug 29, 2019 · 10 comments · Fixed by #310
Closed

Remove deprecated UIWebView #308

goelay opened this issue Aug 29, 2019 · 10 comments · Fixed by #310

Comments

@goelay
Copy link

goelay commented Aug 29, 2019

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.
After you’ve corrected the issues, you can use Xcode or Application Loader to upload a new binary to App Store Connect.
Best regards,
The App Store Team

Matamo is using UIWebView to get defaultuserAgent(). Please fix this.

@brototyp
Copy link
Member

Hi @goelay, thanks for the bug report. Feel free to fix this. I am accepting PRs in this regard.

@brototyp brototyp changed the title Urgent : Apple Rejection Remove deprecated UIWebView Aug 29, 2019
@notjosh
Copy link
Contributor

notjosh commented Aug 30, 2019

An issue here is that WKWebView runs its JavaScript asynchronously.

Someone put together the methods of getting the User-Agent string here: https://gist.github.com/Koze/cfda5d2af12f6215424e.

End result is that URLSessionDispatcher.defaultUserAgent() can't return a String if it's using WKWebView :(

The good news is that the User-Agent is set async in the first place:

DispatchQueue.main.async {
    self.userAgent = userAgent ?? URLSessionDispatcher.defaultUserAgent()
}

But I imagine running on the JS thread would be a lot slowing in CPU-time, so there's probably greater risk of a race condition here if we use WKWebView than before, but what's the worst case scenario? An empty string? Is that acceptable? If so, I'm happy to make a PR for it.

@brototyp
Copy link
Member

@notjosh Thanks for your ideas. I took the liberty and create a PR based on your ideas.

I do think it's not a huge issue if calculating the user agent takes a little longer. It's only needed at dispatch time. Events aren't set to the server right away but just once a few got collected. Event if there are quite some events collected right away, the user agent should already be generated at that time. Worst case is that some information that would usually be gathered from the user agent, isn't available on the backend.

If you don't mind, please have a look at my PR.

@notjosh
Copy link
Contributor

notjosh commented Sep 2, 2019

Hey, awesome, this looks like it'll do the job just nicely. Great work :)

And, agree on the worst case being unlikely and not a huge issue. :shipit:

@brototyp
Copy link
Member

brototyp commented Sep 3, 2019

Awesome. Thanks for the feedback everyone.This got merged and will be part of the next release.

@brototyp
Copy link
Member

brototyp commented Sep 3, 2019

This just got released in version 7.0.0

@xmanu
Copy link

xmanu commented Sep 4, 2019

Thanks for the great work!

Could this possibly be backported to a 6.0.2 version that doesn't require iOS 10?
I would like to keep iOS 9 as deployment target, but currently I would be forced to up that to 10, just because of MatomoTracker...

@brototyp
Copy link
Member

brototyp commented Sep 4, 2019

Yeah, the problem is, that we currently can't run tests on Simulators smaller than iOS 10. Since we require Swift 5, there is (afaik) no way to execute a test on a iOS 9 Simulator while using Xcode 10.3, right?

@xmanu
Copy link

xmanu commented Sep 4, 2019

Yeah. That might be a problem... I will start a discussion about dropping iOS 9 with the team. This would also drop quite some legacy code in my case...

@brototyp
Copy link
Member

brototyp commented Sep 4, 2019

The only thing I've got in mind on top of that is to fork, change it from iOS 10 to 9 in your fork and use it this way. It should work fine on iOS 9 as well. I didn't use any API that's not supported on iOS 9. It's just a bit of a workaround for now.

hcbarry pushed a commit to hcbarry/matomo-sdk-ios that referenced this issue Feb 11, 2020
hcbarry pushed a commit to hcbarry/matomo-sdk-ios that referenced this issue Feb 11, 2020
hcbarry pushed a commit to hcbarry/matomo-sdk-ios that referenced this issue Mar 2, 2020
hcbarry pushed a commit to hcbarry/matomo-sdk-ios that referenced this issue Mar 2, 2020
brototyp pushed a commit that referenced this issue Mar 3, 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

Successfully merging a pull request may close this issue.

4 participants