-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix deprecated kUTTypeGIF usage on iOS 15+ #10896
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
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a build error on iOS 15+ caused by the use of the deprecated kUTTypeGIF constant. The fix correctly replaces it with UTTypeGIF.identifier from the UniformTypeIdentifiers framework for newer iOS versions. I have a suggestion to improve the implementation by using the modern API starting from iOS 14, where it became available, and to clean up some minor formatting issues that deviate from standard Objective-C style.
| if (@available(iOS 15.0, *)) { | ||
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = | ||
| (NSString *)UTTypeGIF.identifier; | ||
| } else { | ||
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = | ||
| (NSString *)kUTTypeGIF; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this correctly fixes the deprecation warning on iOS 15, the UniformTypeIdentifiers API is available starting from iOS 14. It's better to adopt the new API from iOS 14 onwards. Also, the cast (NSString *) on UTTypeGIF.identifier is redundant as it already returns an NSString *. Finally, the indentation in this block is inconsistent and an extra blank line has been added, both of which should be fixed to improve readability.
if (@available(iOS 14.0, *)) {
options[(NSString *)kCGImageSourceTypeIdentifierHint] = UTTypeGIF.identifier;
} else {
options[(NSString *)kCGImageSourceTypeIdentifierHint] = (NSString *)kUTTypeGIF;
}References
- Code should follow the relevant style guides and use the correct auto-formatter for each language. The indentation in the added code block is inconsistent and an extra blank line was added. (link)
|
This PR only updates a deprecated iOS constant. |
|
In the future, please follow the steps in the PR template instead of deleting them all. Closing since there is already a PR for this issue that follows our process (#10848). |
Fixes iOS 15+ build error caused by deprecated
kUTTypeGIFusage.Replaced deprecated
kUTTypeGIFwithUTTypeGIFfromUniformTypeIdentifiers, resolving the compiler error when warnings are treated as errors.Fixes #180162