Skip to content

Commit 966a132

Browse files
AlexV525claude
andauthored
fix: Remove AssetsLibrary usage for iOS 26 compatibility (#366)
## Summary - Remove the AssetsLibrary framework import and the three ALAsset-based methods on `SYMetadata` (`metadataWithAsset:`, `metadataWithAssetURL:`, `dictionaryWithAssetURL:`) — AssetsLibrary is removed from the iOS 26 SDK. - These methods have zero callers in this repository (verified via full-tree grep). The plugin's own metadata flow uses only `metadataWithFileURL:` / `metadataWithImageData:` / `dataWithImageData:andMetadata:`, all backed by `CGImageSource` and unaffected. ## Relationship to #343 #343 also targets iOS 26 but migrates the ALAsset methods to PHAsset, adding threading/iCloud/availability infrastructure for API that is not reachable from the plugin. This PR takes the minimal path — delete the dead code — since restoring PHAsset-equivalent functionality can happen in a follow-up if any external consumer ever needs it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f174eb3 commit 966a132

2 files changed

Lines changed: 0 additions & 53 deletions

File tree

packages/flutter_image_compress_common/ios/Classes/SYPictureMetadata/SYMetadata.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/index.html
3030
// http://www.exiv2.org/tags.html
3131

32-
@class ALAsset;
33-
3432
@interface SYMetadata : SYMetadataBase
3533

3634
@property SYMETADATA_PROPERTY_COPY NSDictionary *originalDictionary;
@@ -72,13 +70,9 @@
7270
@property (nonatomic, copy, readonly) NSString *profileName;
7371

7472
+ (instancetype)metadataWithDictionary:(NSDictionary *)dictionary;
75-
+ (instancetype)metadataWithAsset:(ALAsset *)asset __TVOS_PROHIBITED;
76-
+ (instancetype)metadataWithAssetURL:(NSURL *)assetURL __TVOS_PROHIBITED;
7773
+ (instancetype)metadataWithFileURL:(NSURL *)fileURL;
7874
+ (instancetype)metadataWithImageData:(NSData *)imageData;
7975

80-
+ (NSDictionary *)dictionaryWithAssetURL:(NSURL *)assetURL __TVOS_PROHIBITED;
81-
8276
+ (NSData *)dataWithImageData:(NSData *)imageData andMetadata:(SYMetadata *)metadata;
8377

8478
- (NSDictionary *)differencesFromOriginalMetadataToModel;

packages/flutter_image_compress_common/ios/Classes/SYPictureMetadata/SYMetadata.m

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
#import "SYMetadata.h"
1111
#import "NSDictionary+SY.h"
1212

13-
#if !TARGET_OS_TV
14-
#import <AssetsLibrary/AssetsLibrary.h>
15-
#endif
16-
1713
#define SYKeyForMetadata(name) NSStringFromSelector(@selector(metadata##name))
1814
#define SYDictionaryForMetadata(name) SYPaste(SYPaste(kCGImageProperty,name),Dictionary)
1915
#define SYClassForMetadata(name) SYPaste(SYMetadata,name)
@@ -46,22 +42,6 @@ + (instancetype)metadataWithDictionary:(NSDictionary *)dictionary
4642
return instance;
4743
}
4844

49-
+ (instancetype)metadataWithAsset:(ALAsset *)asset
50-
{
51-
#if !TARGET_OS_TV
52-
ALAssetRepresentation *representation = [asset defaultRepresentation];
53-
return [self metadataWithDictionary:[representation metadata]];
54-
#else
55-
return nil;
56-
#endif
57-
}
58-
59-
+ (instancetype)metadataWithAssetURL:(NSURL *)assetURL
60-
{
61-
NSDictionary *dictionary = [self dictionaryWithAssetURL:assetURL];
62-
return [self metadataWithDictionary:dictionary];
63-
}
64-
6545
+ (instancetype)metadataWithFileURL:(NSURL *)fileURL
6646
{
6747
if (!fileURL)
@@ -144,33 +124,6 @@ + (NSData *)dataWithImageData:(NSData *)imageData andMetadata:(SYMetadata *)meta
144124
return (success ? data : nil);
145125
}
146126

147-
#pragma mark - Getting metadata
148-
149-
+ (NSDictionary *)dictionaryWithAssetURL:(NSURL *)assetURL
150-
{
151-
#if !TARGET_OS_TV
152-
__block ALAsset *assetAtUrl = nil;
153-
ALAssetsLibrary* library = [[ALAssetsLibrary alloc] init];
154-
155-
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
156-
[library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
157-
assetAtUrl = asset;
158-
dispatch_semaphore_signal(sema);
159-
} failureBlock:^(NSError *error) {
160-
dispatch_semaphore_signal(sema);
161-
}];
162-
dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
163-
164-
if (!assetAtUrl)
165-
return nil;
166-
167-
ALAssetRepresentation *representation = [assetAtUrl defaultRepresentation];
168-
return [representation metadata];
169-
#else
170-
return nil;
171-
#endif
172-
}
173-
174127
#pragma mark - Mapping
175128

176129
+ (NSDictionary *)JSONKeyPathsByPropertyKey

0 commit comments

Comments
 (0)