Skip to content

iOS 26: remove old AssetsLibrary API and fix runtime crash#368

Merged
numandev1 merged 3 commits intonumandev1:mainfrom
Titozzz:main
Sep 19, 2025
Merged

iOS 26: remove old AssetsLibrary API and fix runtime crash#368
numandev1 merged 3 commits intonumandev1:mainfrom
Titozzz:main

Conversation

@Titozzz
Copy link
Contributor

@Titozzz Titozzz commented Sep 11, 2025

DISCLAIMER: AI GENERATED CODE

I used Cursor to make that PR. I've re-read, tested everything but I prefer transparency!

Summary

This update removes all dependencies on the deprecated AssetsLibrary framework from the iOS implementation of react-native-compressor. The library now exclusively uses the modern Photos framework for accessing device photo library assets, ensuring better compatibility with current and future iOS versions while eliminating deprecated API usage.

EDIT:

While testing on iOS 26 there was a breaking change in URL handling in swift 6.
The generated url was file://file://

I've added an extra commit taking care of that, that should be backward compatible
Here is my chat that helped me investigate: https://chatgpt.com/share/68cc145e-ac88-8005-a07c-f1e45a1642c5

Key Changes:

Removed AssetsLibrary import from video compression module
Eliminated legacy assets-library:// URL scheme support
Simplified asset handling logic to use only ph:// URLs
Cleaned up unused constants and dead code
Maintained full backward compatibility for modern photo library access

EDIT:
Fixed a runtime crash on iOS 26

Impact:

✅ No breaking changes for existing functionality
✅ Improved iOS compatibility with modern frameworks
✅ Reduced bundle size by removing unused dependencies
✅ Future-proof implementation aligned with Apple's recommendations

Changelog

[iOS] [CLEANUP/FIX] - Remove deprecated API usage

  • Eliminated PHAsset.fetchAssets(withALAssetURLs:options:) usage
  • Replaced with modern PHAsset.fetchAssets(withLocalIdentifiers:options:) method
  • Removed conditional logic for legacy URL schemes
  • Fixed a runtime crash that would occur when passing url already containing schemes

Test Plan

Build with XCode 26 and see if that work

The commit was a quick fix for iOS 14.3, but it is not a robust or forward-compatible solution.

On iOS 18–26 / Swift 6, it can produce different paths or invalid URLs, which explains your problem.
@Titozzz Titozzz changed the title chore: remove old AssetsLibrary API iOS 26: remove old AssetsLibrary API and fix runtime crash Sep 18, 2025
@garshythoel
Copy link

@numandev1 Can you please review and merge ?

Copy link
Owner

@numandev1 numandev1 left a comment

Choose a reason for hiding this comment

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

LGTM

@numandev1 numandev1 merged commit 7f54cfb into numandev1:main Sep 19, 2025
1 check failed
@garshythoel
Copy link

@numandev1 Awesome - look forward to the new release on npm!

@numandev1
Copy link
Owner

released in 1.13.0

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.

3 participants