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

Migrate to WKWebView instead of UIWebView #362

Merged
merged 5 commits into from
May 8, 2020
Merged

Migrate to WKWebView instead of UIWebView #362

merged 5 commits into from
May 8, 2020

Conversation

brol1dev
Copy link
Contributor

There is going to be a follow up CL to update the sample app. Right now the library has been migrated to WKWebVIew.

Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.m Outdated Show resolved Hide resolved
Classes/YTPlayerView.m Outdated Show resolved Hide resolved
Classes/YTPlayerView.m Show resolved Hide resolved
Classes/YTPlayerView.m Outdated Show resolved Hide resolved
Classes/YTPlayerView.m Outdated Show resolved Hide resolved
@JaredHalpern
Copy link

Is there a current plan as far as merging this and doing a release?

Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.h Outdated Show resolved Hide resolved
Classes/YTPlayerView.m Outdated Show resolved Hide resolved
Classes/YTPlayerView.m Outdated Show resolved Hide resolved
Eric Vargas added 2 commits April 6, 2020 12:56
Replaced all references to UIWebView with WKWebView. Had to change APIs, most of the work is that the JS calls that return values, e.g. getDuration() are now async. All methods that expect a return value now use a callback for the expected async result.
@ahmad-ishfaq
Copy link

When will this PR be merged?

@Truzicka
Copy link

Truzicka commented May 5, 2020

It would be good that this fix is merge ASAP as Apple is now refusing new builds with UIWebView

ITMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted

Copy link

@009Benny 009Benny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apple is now refusing new builds with UIWebView

@LeglessSheep
Copy link

Can we have a date for this to go up?

I can't upload my builds to Test Flight because of this.

@harumidiv
Copy link

LGTM

Eric Vargas added 2 commits May 7, 2020 20:52
UIWebView used to always returned the JS result as an NSString, but with WKWebView the type is inferred when returned making it so that the current logic of stringFromEvaluatingJavaScript:completionHandler: is not sufficient to capture the types returned by the iFrame API.
Fix internal returned type for async APIs.
@todd-patterson todd-patterson merged commit e9dbe9e into youtube:master May 8, 2020
Comment on lines +250 to +253
if (!result || ![result isKindOfClass:[NSNumber class]]) {
completionHandler(0, nil);
}
completionHandler([result floatValue], nil);
Copy link

@jkmathew jkmathew May 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case if the result is not an NSNumber instance, this may crash (in case of result does not have floatValue function) or completionHandler will be called twice(otherwise).
either need to return in the if or need an else?

This is applicable to other sections too...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for noticing, will be posting a fix for this soon.

@ghazalahk4
Copy link

Hello, Apple is rejecting builds now due to this. Please let us know when will be you able to merge the changes?

@brol1dev
Copy link
Contributor Author

This is merged already.

@brol1dev brol1dev deleted the feat/wkwebview branch May 11, 2020 18:01
todd-patterson pushed a commit that referenced this pull request May 11, 2020
…andler

Follow-up to PR #362: Missing a return statement in several places, which resulted in both the correct and incorrect completionHandlers being called. This could lead to crashes if the callback result is empty or represents an unexpected type.
@ghazalahk4
Copy link

This is merged already.

I am on 0.1.6 and the use of UIWebView is all over the library. Please see the screenshot attached. Am I doing something wrong?
Screenshot 2020-05-12 at 7 16 31 PM

@lpbas
Copy link

lpbas commented May 12, 2020

You need to wait for a release to happen or use a custom pod to point to the master branch, as such:
pod "youtube-ios-player-helper", :git => 'https://github.com/youtube/youtube-ios-player-helper.git'

@brol1dev
Copy link
Contributor Author

Installing through cocoapods is currently out of sync and might be broken. We are working on updating the pod repo.

@ghazalahk4
Copy link

You need to wait for a release to happen or use a custom pod to point to the master branch, as such:
pod "youtube-ios-player-helper", :git => 'https://github.com/youtube/youtube-ios-player-helper.git'

@rcvrgs @L4grange
This fixed the build getting rejected by Apple issue. But, now the videos don't play at all and gives the following error:

Screenshot 2020-05-13 at 2 37 50 PM

@lpbas
Copy link

lpbas commented May 13, 2020

I'm also facing an issue where every time I try to load a video, safari opens with my bundle ID as the URL, as I've stated in #374 but I'm not sure if this PR is the cause or something else. (maybe the broken pod implementation?), so I would advise against using the master branch in your production for now.

@ghazalahk4
Copy link

I'm also facing an issue where every time I try to load a video, safari opens with my bundle ID as the URL, as I've stated in #374 but I'm not sure if this PR is the cause or something else. (maybe the broken pod implementation?), so I would advise against using the master branch in your production for now.

Yes, this is what is happening with me too.

@ghazalahk4
Copy link

Installing through cocoapods is currently out of sync and might be broken. We are working on updating the pod repo.

@rcvrgs can you give an idea as to by when it would be synced?

@todd-patterson
Copy link
Collaborator

Hi all,
Sorry for not following-up sooner.

  • Cocoapods has been updated with the changes for WKWebView migration
  • The other issue discussed in the most recent comments about Safari being opened when trying to load a video has also been fixed and published to Cocoapods

Please use the latest version -
https://github.com/youtube/youtube-ios-player-helper/releases

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 this pull request may close these issues.

None yet