Skip to content

Commit ac2db9c

Browse files
authored
[image_picker_ios] Require Flutter 3.47 / iOS 15 and drop deprecated 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.
1 parent 772218b commit ac2db9c

10 files changed

Lines changed: 28 additions & 25 deletions

File tree

‎packages/image_picker/image_picker/CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## NEXT
2+
3+
* Updates README to reflect that the latest version of `image_picker_ios`
4+
requires iOS 15.
5+
* Applications built with older versions of Flutter will continue to use
6+
compatible versions of the platform implementation.
7+
18
## 1.2.4
29

310
* Documents that `retrieveLostData` is a one-time operation that clears the

‎packages/image_picker/image_picker/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ A Flutter plugin for picking images from the image library, and taking new pictu
77

88
| | Android | iOS | Linux | macOS | Web | Windows |
99
|-------------|---------|---------|-------|--------|---------------------------------|-------------|
10-
| **Support** | SDK 24+ | iOS 13+ | Any | 10.15+ | [See `image_picker_for_web`](https://pub.dev/packages/image_picker_for_web#limitations-on-the-web-platform) | Windows 10+ |
10+
| **Support** | SDK 24+ | iOS 15+ | Any | 10.15+ | [See `image_picker_for_web`](https://pub.dev/packages/image_picker_for_web#limitations-on-the-web-platform) | Windows 10+ |
1111

1212
## Setup
1313

‎packages/image_picker/image_picker_ios/CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 0.8.13+12
2+
3+
* Updates minimum supported SDK version to Flutter 3.47/Dart 3.13.
4+
* Updates minimum iOS version to 15.
5+
* Removes the iOS 13 code paths that used the deprecated `kUTTypeGIF`, `kUTTypeImage`, and `kUTTypeMovie` constants, which fail to compile with Xcode 27.
6+
17
## 0.8.13+11
28

39
* Adds an injectable protocol seam for PHImageManager image data requests.

‎packages/image_picker/image_picker_ios/ios/image_picker_ios.podspec‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Downloaded by pub (not CocoaPods).
1818
s.public_header_files = 'image_picker_ios/Sources/image_picker_ios/**/*.h'
1919
s.module_map = 'image_picker_ios/Sources/image_picker_ios/include/ImagePickerPlugin.modulemap'
2020
s.dependency 'Flutter'
21-
s.platform = :ios, '13.0'
21+
s.platform = :ios, '15.0'
2222
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2323
s.resource_bundles = {'image_picker_ios_privacy' => ['image_picker_ios/Sources/image_picker_ios/Resources/PrivacyInfo.xcprivacy']}
2424
end

‎packages/image_picker/image_picker_ios/ios/image_picker_ios/Package.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import PackageDescription
99
let package = Package(
1010
name: "image_picker_ios",
1111
platforms: [
12-
.iOS("13.0")
12+
.iOS("15.0")
1313
],
1414
products: [
1515
.library(name: "image-picker-ios", targets: ["image_picker_ios"])

‎packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/FLTImagePickerImageUtil.m‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,7 @@ + (GIFInfo *)scaledGIFImage:(NSData *)data
125125
maxHeight:(NSNumber *)maxHeight {
126126
NSMutableDictionary<NSString *, id> *options = [NSMutableDictionary dictionary];
127127
options[(NSString *)kCGImageSourceShouldCache] = @YES;
128-
NSString *gifTypeIdentifier;
129-
if (@available(iOS 14.0, *)) {
130-
gifTypeIdentifier = UTTypeGIF.identifier;
131-
} else {
132-
gifTypeIdentifier = (NSString *)kUTTypeGIF;
133-
}
134-
options[(NSString *)kCGImageSourceTypeIdentifierHint] = gifTypeIdentifier;
128+
options[(NSString *)kCGImageSourceTypeIdentifierHint] = UTTypeGIF.identifier;
135129

136130
CGImageSourceRef imageSource =
137131
CGImageSourceCreateWithData((__bridge CFDataRef)data, (__bridge CFDictionaryRef)options);

‎packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/FLTImagePickerPhotoAssetUtil.m‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,9 @@ + (NSString *)saveImageWithMetaData:(NSDictionary *)metaData
9999
+ (NSString *)saveImageWithMetaData:(NSDictionary *)metaData
100100
gifInfo:(GIFInfo *)gifInfo
101101
path:(NSString *)path {
102-
CFStringRef imageType;
103-
if (@available(iOS 14.0, *)) {
104-
imageType = (__bridge CFStringRef)UTTypeGIF.identifier;
105-
} else {
106-
imageType = kUTTypeGIF;
107-
}
108102
CGImageDestinationRef destination = CGImageDestinationCreateWithURL(
109-
(__bridge CFURLRef)[NSURL fileURLWithPath:path], imageType, gifInfo.images.count, NULL);
103+
(__bridge CFURLRef)[NSURL fileURLWithPath:path], (__bridge CFStringRef)UTTypeGIF.identifier,
104+
gifInfo.images.count, NULL);
110105

111106
NSDictionary *frameProperties = @{
112107
(__bridge NSString *)kCGImagePropertyGIFDictionary : @{

‎packages/image_picker/image_picker_ios/ios/image_picker_ios/Sources/image_picker_ios/FLTImagePickerPlugin.m‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#import <PhotosUI/PHPhotoLibrary+PhotosUISupport.h>
1212
#import <PhotosUI/PhotosUI.h>
1313
#import <UIKit/UIKit.h>
14+
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
1415

1516
#import "./include/image_picker_ios/messages.g.h"
1617
#import "FLTImagePickerImageUtil.h"
@@ -126,10 +127,10 @@ - (void)launchUIImagePickerWithSource:(nonnull FLTSourceSpecification *)source
126127
imagePickerController.delegate = self;
127128
NSMutableArray<NSString *> *mediaTypes = [[NSMutableArray alloc] init];
128129
if (context.includeImages) {
129-
[mediaTypes addObject:(NSString *)kUTTypeImage];
130+
[mediaTypes addObject:UTTypeImage.identifier];
130131
}
131132
if (context.includeVideo) {
132-
[mediaTypes addObject:(NSString *)kUTTypeMovie];
133+
[mediaTypes addObject:UTTypeMovie.identifier];
133134
imagePickerController.videoQuality = UIImagePickerControllerQualityTypeHigh;
134135
}
135136
imagePickerController.mediaTypes = mediaTypes;

‎packages/image_picker/image_picker_ios/lib/image_picker_ios.dart‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ class ImagePickerIOS extends ImagePickerPlatform {
182182
options,
183183
);
184184

185-
return (await _hostApi.pickMedia(
186-
mediaSelectionOptions,
187-
)).map((String? path) => XFile(path!)).toList();
185+
return (await _hostApi.pickMedia(mediaSelectionOptions))
186+
.map((String? path) => XFile(path!))
187+
.toList();
188188
}
189189

190190
MaxSize _imageOptionsToMaxSizeWithValidation(ImageOptions imageOptions) {

‎packages/image_picker/image_picker_ios/pubspec.yaml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: image_picker_ios
22
description: iOS implementation of the image_picker plugin.
33
repository: https://github.com/flutter/packages/tree/main/packages/image_picker/image_picker_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+image_picker%22
5-
version: 0.8.13+11
5+
version: 0.8.13+12
66

77
environment:
8-
sdk: ^3.11.0
9-
flutter: ">=3.41.0"
8+
sdk: ^3.13.0
9+
flutter: ">=3.47.0"
1010

1111
flutter:
1212
plugin:

0 commit comments

Comments
 (0)