Repository navigation
[image_picker_ios] Fix deprecated kUTTypeGIF usage - #10848
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. |
There was a problem hiding this comment.
Code Review
This pull request correctly addresses the deprecation of kUTTypeGIF by using the UTTypeGIF API on iOS 14 and newer, with a proper fallback for older versions. The changes are implemented correctly in both FLTImagePickerImageUtil.m and FLTImagePickerPhotoAssetUtil.m, and the version and changelog updates are appropriate. I have one minor suggestion to improve code consistency between the two modified Objective-C files. Otherwise, the changes look good.
| if (@available(iOS 14.0, *)) { | ||
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = UTTypeGIF.identifier; | ||
| } else { | ||
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = (NSString *)kUTTypeGIF; | ||
| } |
There was a problem hiding this comment.
To improve consistency with the pattern used in FLTImagePickerPhotoAssetUtil.m and to enhance readability, consider defining the GIF type identifier in a local variable before using it. This separates the logic for determining the identifier from its usage and avoids repeating the dictionary key.
| if (@available(iOS 14.0, *)) { | |
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = UTTypeGIF.identifier; | |
| } else { | |
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = (NSString *)kUTTypeGIF; | |
| } | |
| NSString *gifTypeIdentifier; | |
| if (@available(iOS 14.0, *)) { | |
| gifTypeIdentifier = UTTypeGIF.identifier; | |
| } else { | |
| gifTypeIdentifier = (NSString *)kUTTypeGIF; | |
| } | |
| options[(NSString *)kCGImageSourceTypeIdentifierHint] = gifTypeIdentifier; |
References
- The repository style guide (lines 10-12) states that code should follow relevant style guides for each language. The suggestion to improve consistency and avoid repetition aligns with general Objective-C best practices for writing maintainable and readable code. (link)
|
test-exempt: code refactor with no semantic change |
vashworth
left a comment
There was a problem hiding this comment.
LGTM! Thank you for your contribution!
There was a problem hiding this comment.
@ritoban23 nit: do you want to address gemini's comment? but lgtm
|
@okorohelijah Addressed - updated for consistency with the other file! Thank you! |
fix deprecated kUTTypeGIF usage in image_picker_ios
cfd80ec to
5c9e9db
Compare
flutter/packages@510dd40...837dbbd 2026-01-30 [email protected] Roll Flutter from da72d59 to 1d9d6a9 (33 revisions) (flutter/packages#10931) 2026-01-30 [email protected] [image_picker_ios] Fix deprecated kUTTypeGIF usage (flutter/packages#10848) 2026-01-30 [email protected] [cross_file] [web] Separate "Save As" implementation details from XFile web class (flutter/packages#10397) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@510dd40...837dbbd 2026-01-30 [email protected] Roll Flutter from da72d59 to 1d9d6a9 (33 revisions) (flutter/packages#10931) 2026-01-30 [email protected] [image_picker_ios] Fix deprecated kUTTypeGIF usage (flutter/packages#10848) 2026-01-30 [email protected] [cross_file] [web] Separate "Save As" implementation details from XFile web class (flutter/packages#10397) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@510dd40...837dbbd 2026-01-30 [email protected] Roll Flutter from da72d59 to 1d9d6a9 (33 revisions) (flutter/packages#10931) 2026-01-30 [email protected] [image_picker_ios] Fix deprecated kUTTypeGIF usage (flutter/packages#10848) 2026-01-30 [email protected] [cross_file] [web] Separate "Save As" implementation details from XFile web class (flutter/packages#10397) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
flutter/packages@510dd40...837dbbd 2026-01-30 [email protected] Roll Flutter from da72d59 to 1d9d6a9 (33 revisions) (flutter/packages#10931) 2026-01-30 [email protected] [image_picker_ios] Fix deprecated kUTTypeGIF usage (flutter/packages#10848) 2026-01-30 [email protected] [cross_file] [web] Separate "Save As" implementation details from XFile web class (flutter/packages#10397) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
[image_picker_ios] Fix deprecated kUTTypeGIF usage This PR replaces the deprecated `kUTTypeGIF` constant with the modern `UTTypeGIF` API to fix iOS 15+ deprecation warnings in the image_picker_ios plugin. **Changes:** - Added `UniformTypeIdentifiers` framework import to affected files - Replaced `kUTTypeGIF` with `UTTypeGIF.identifier` for iOS 14+ - Added `@available(iOS 14.0, *)` checks to maintain backward compatibility with iOS 13 The minimum iOS deployment target is 13.0, so the code uses conditional compilation to support both the new API (iOS 14+) and the deprecated API (iOS 13) where necessary. **Files changed:** - `FLTImagePickerImageUtil.m` - Updated GIF image source type hint - `FLTImagePickerPhotoAssetUtil.m` - Updated GIF destination type Fixes flutter/flutter#181291 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
flutter/packages@510dd40...837dbbd 2026-01-30 [email protected] Roll Flutter from 8298e59 to 397950a (33 revisions) (flutter/packages#10931) 2026-01-30 [email protected] [image_picker_ios] Fix deprecated kUTTypeGIF usage (flutter/packages#10848) 2026-01-30 [email protected] [cross_file] [web] Separate "Save As" implementation details from XFile web class (flutter/packages#10397) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…kUTType code paths (#13224) With Xcode 27 the `xcode analyze` step of `Mac_arm64 ios_platform_tests` fails on image_picker_ios: ``` FLTImagePickerImageUtil.m:132:37: error: 'kUTTypeGIF' is deprecated: first deprecated in iOS 15.0 - Use UTTypeGIF or UTType.gif (swift) instead. [-Werror,-Wdeprecated-declarations] 132 | gifTypeIdentifier = (NSString *)kUTTypeGIF; ``` Staging run on Xcode 27 (27A266a): https://ci.chromium.org/b/8668491298933206513 `kUTTypeGIF` is only referenced in the `else` branch of an `if (@available(iOS 14.0, *))` check (added in #10848), so it never runs on iOS 14+. The compiler still has to compile that branch though, and Xcode 27 only supports deployment targets of iOS 15 and up, so the plugin is now always built with `-target …-ios15.0` and the reference trips `-Wdeprecated-declarations`, which `xcode analyze` treats as an error. The build stops at the first failing file; `FLTImagePickerPhotoAssetUtil.m` has the same pattern, and `FLTImagePickerPlugin.m` uses `kUTTypeImage` / `kUTTypeMovie` unconditionally. Flutter 3.47 dropped iOS 13 and 14, so rather than keep those code paths alive this raises the package minimum to Flutter 3.47 / Dart 3.13 and iOS 15 (podspec and `Package.swift`), and deletes the iOS 13 branches: `UTTypeGIF`, `UTTypeImage` and `UTTypeMovie` are used directly. Clients on older Flutter stay on the previous version through `pub`, so this is a patch bump, same as #10231 did for iOS 13. The remaining `@available(iOS 13/14, *)` checks in `FLTImagePickerPlugin.m` are now dead too; I left them alone since that file is being rewritten in Swift in #13235 and they can go there. Also updates the app-facing `image_picker` README's support table to iOS 15 (with a `## NEXT` entry, no version bump), the same way #10470 did for iOS 13. Verified on Xcode 27 (with the earlier, fallback-preserving version of this change): `xcode analyze`, `xcode analyze deprecation` and the native tests pass for image_picker_ios — https://ci.chromium.org/b/8668086845504323249 (shard 3 of a staging replay; the remaining `native test` failure in that build is in_app_purchase_storekit, flutter/flutter#194285). Part of flutter/flutter#194019 ## Pre-Review Checklist Test exemption: native-only change with no behaviour change; the existing GIF tests in `RunnerTests/ImageUtilTests.swift` and `RunnerTests/PhotoAssetUtilTests.swift` already exercise both call sites. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
[image_picker_ios] Fix deprecated kUTTypeGIF usage
This PR replaces the deprecated
kUTTypeGIFconstant with the modernUTTypeGIFAPI to fix iOS 15+ deprecation warnings in the image_picker_ios plugin.Changes:
UniformTypeIdentifiersframework import to affected fileskUTTypeGIFwithUTTypeGIF.identifierfor iOS 14+@available(iOS 14.0, *)checks to maintain backward compatibility with iOS 13The minimum iOS deployment target is 13.0, so the code uses conditional compilation to support both the new API (iOS 14+) and the deprecated API (iOS 13) where necessary.
Files changed:
FLTImagePickerImageUtil.m- Updated GIF image source type hintFLTImagePickerPhotoAssetUtil.m- Updated GIF destination typeFixes flutter/flutter#181291
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3