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

Fix a crash for "WebCoreNSURLSessionTaskTransactionMetrics _privacyStance]: unrecognized selector sent to instance" #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

staskus
Copy link

@staskus staskus commented Jan 18, 2023

Fixes: #54

Due to issues with WebKit and tvOS, [WebCoreNSURLSessionTaskTransactionMetrics _privacyStance]: unrecognized selector sent to instance crash anytime the video is played.

Solution

Add a dummy _privacyStance getter at runtime which returns 0. The system expects a value from nw_connection_privacy_stance_t enum where 0 means nw_connection_privacy_stance_unknown.

Let me know if you have any questions, thanks!

@staskus staskus mentioned this pull request Jan 19, 2023
@alferd4829
Copy link

alferd4829 commented Oct 1, 2023

Hi staskus, can you teach me where and how to add the dummy? I am only a beginner of the coding

@staskus
Copy link
Author

staskus commented Oct 2, 2023

Hey, @alferd4829. Sure.

I am only a beginner of the coding

Don't worry, the workaround I'm proposing here is usually not what is needed when coding apps.

can you teach me where and how to add the dummy?

Here are the changes of the pull request: https://github.com/jvanakker/tvOSBrowser/pull/58/files

It's enough to add WebCoreNSURLSessionTaskTransactionMetrics+AddPrivacyStance.m file to the project next to other classes to the workaround would work. Objective-C allows overriding methods even in the category (extension). Here I am overriding the load method of WebCoreNSURLSessionTaskTransactionMetrics class, and using some more Objective-C runtime magic to add privacyStance method to the class, which the system expects to exist.

@alferd4829
Copy link

Thank you for your reply.
I try to add the File inside Browser folder and choose Objective-C file as the file template. Next what should I choose for this file type?
TVOS

@staskus
Copy link
Author

staskus commented Oct 2, 2023

I try to add the File inside Browser folder and choose Objective-C file as the file template. Next what should I choose for this file type?

This file is Category.

However, in this instance you can choose anything, File Type choice determines a boilerplate for the file. However, you will just copy-paste changes from this pull request.

@alferd4829
Copy link

alferd4829 commented Oct 2, 2023

Thank you for your quick reply.

Which file that I need to choose for?
Supported File

@staskus
Copy link
Author

staskus commented Oct 2, 2023

Which file that I need to choose for?

.m file. I found .h file not required in this case.

@alferd4829
Copy link

Thank you. It works now. Do you had any solution to make the video played in full screen mode?

@staskus
Copy link
Author

staskus commented Oct 2, 2023

Thank you. It works now. Do you had any solution to make the video played in full screen mode?

Unfortunately, no. I haven't really looked into that.

@alferd4829
Copy link

Understood. Hope you can found out the solution in one day

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.

App Crash tvOS 16
2 participants