Skip to content

fix: Incompatible with iOS 26.0 under flutter_image_compress_common#343

Open
alpinnz wants to merge 4 commits intofluttercandies:mainfrom
alpinnz:main
Open

fix: Incompatible with iOS 26.0 under flutter_image_compress_common#343
alpinnz wants to merge 4 commits intofluttercandies:mainfrom
alpinnz:main

Conversation

@alpinnz
Copy link

@alpinnz alpinnz commented Sep 21, 2025

This PR fixes compatibility issues with iOS 26.0 in the flutter_image_compress_common package.
Previously, certain APIs that were deprecated or removed in iOS 26.0 were still being used, causing build errors.

Changes include:

  • Replacing deprecated ALAsset and ALAssetRepresentation with PHAsset from the Photos framework.
  • Updating code to ensure proper functionality on iOS 26.0 and later.
  • Minor code cleanup and improvements to maintain backward compatibility.

This update ensures that the package can now build successfully on iOS 26.0 without introducing breaking changes for older iOS versions.

@CaiJingLong
Copy link
Member

Hi, what is the minimum supported iOS SDK version for this new writing method? What is the minimum supported iOS device version?

@alpinnz
Copy link
Author

alpinnz commented Sep 30, 2025

Hi. The new method is based on PHAsset, which has been available since iOS 8.0.
So technically it works from iOS 8 and above.

That said, Flutter itself now requires iOS 11.0 as the minimum deployment target, so in practice the minimum supported iOS SDK and device version is 11.0.

This update has also been tested to build and run fine on iOS 16+ (iOS 26.0 reference).

Hi, what is the minimum supported iOS SDK version for this new writing method? What is the minimum supported iOS device version?

@AlexV525 AlexV525 requested a review from Copilot October 20, 2025 07:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Migrates iOS metadata handling from the deprecated AssetsLibrary (ALAsset) APIs to the Photos (PHAsset) framework to resolve build issues on newer iOS versions. Also includes minor cleanup and comment updates.

  • Replace ALAsset/ALAssetRepresentation usage with PHAsset and PHImageManager requests
  • Remove ALAsset-based helper methods and add PHAsset-based equivalents
  • Minor comment and spelling fixes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 11 comments.

File Description
packages/flutter_image_compress_common/ios/Classes/SYPictureMetadata/SYMetadata.m Replaces ALAsset metadata extraction with PHImageManager-based extraction; adds PHAsset helpers.
packages/flutter_image_compress_common/ios/Classes/SYPictureMetadata/SYMetadata.h Updates public API to PHAsset-based methods; removes ALAsset references; adjusts comments.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@AlexV525
Copy link
Member

@alpinnz Sorry for the late review. Could you address the review produced above? You can also find relevant implementations in photo_manager regarding PHAsset.

@alpinnz
Copy link
Author

alpinnz commented Feb 11, 2026

Hi @AlexV525, @CaiJingLong

I’ve pushed new commits addressing the review:

  • Restored dictionaryWithAssetURL: as a deprecated wrapper to avoid breaking changes.
  • Replaced Photos import in header with forward declaration (@class PHAsset;).
  • Fixed incorrect comments and clarified fallback metadata note.
  • Reduced duplicated PHAsset metadata logic.
  • Enabled networkAccessAllowed = YES for iCloud assets.
  • Updated iOS deployment target to 13.0.

Please take another look. Thanks 🙏

Copy link
Member

@AlexV525 AlexV525 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for the patch

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AlexV525
Copy link
Member

The review from Copilot still looks promising. Consider fixing them before getting merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants