Avoid calling keyWindow on any UIScene#46832
Closed
cipolleschi wants to merge 1 commit into
Closed
Conversation
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D63890980 |
4951f17 to
2167fa2
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D63890980 |
Summary: After bumping to minIOSVersion 15.1, we refactored the code to remove some check. In the refactoring, we changed how the `keyWindow` is returned and now we are unsafely casting `UIScene` to `UIWindowScene`. We have some internal apps that use `UIScene` that are not `UIWindowScene` and the change is causing them to crash. This change fixes the crash by checking whether the selector is available in the UIScene and casting it only in that case. Otherwise we return `nil`, the same behavior we used to have before the refactor. ## Changelog [iOS][Fixed] - Cast the UIScene to UIWindowScene only if the scene respond to the selector Reviewed By: javache Differential Revision: D63890980
2167fa2 to
c501ed3
Compare
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D63890980 |
Contributor
|
This pull request has been merged in fdee0eb. |
Collaborator
|
This pull request was successfully merged by @cipolleschi in fdee0eb When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
After bumping to minIOSVersion 15.1, we refactored the code to remove some check.
In the refactoring, we changed how the
keyWindowis returned and now we are unsafely castingUIScenetoUIWindowScene.We have some internal apps that use
UIScenethat are notUIWindowSceneand the change is causing them to crash.This change fixes the crash by checking whether the selector is available in the UIScene and casting it only in that case.
Otherwise we return
nil, the same behavior we used to have before the refactor.Changelog
[iOS][Fixed] - Cast the UIScene to UIWindowScene only if the scene respond to the selector
Differential Revision: D63890980