react-native-compressor icon indicating copy to clipboard operation
react-native-compressor copied to clipboard

Remove AssetsLibrary

Open fahelmoreira opened this issue 4 months ago • 5 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-compressor/ios/Video/VideoMain.swift b/node_modules/react-native-compressor/ios/Video/VideoMain.swift
index 6fe5e9c..af8a0b5 100644
--- a/node_modules/react-native-compressor/ios/Video/VideoMain.swift
+++ b/node_modules/react-native-compressor/ios/Video/VideoMain.swift
@@ -1,5 +1,4 @@
 import Foundation
-import AssetsLibrary
 import AVFoundation
 import Photos
 import MobileCoreServices

This issue body was partially generated by patch-package.

fahelmoreira avatar Sep 10 '25 17:09 fahelmoreira

👋 @fahelmoreira Thanks for opening your issue here! If you find this package useful hit the star🌟!

github-actions[bot] avatar Sep 10 '25 17:09 github-actions[bot]

We also faced this issue when building our app on Xcode 26 on an iOS26 simulator,

Showing Recent Errors Only
/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.0.sdk/usr/lib/swift/AssetsLibrary.swiftmodule/x86_64-apple-ios-simulator.swiftinterface:1:1: 
failed to build module 'AssetsLibrary'; 
this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.17.14 clang-1700.3.17.1)', 
while this compiler is 'Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)'). 
Please select a toolchain which matches the SDK.

It seems like the AssetsLibrary extension is obsolete from the x86_64-apple-ios-simulator.swiftinterface for iOS26.

// swift-interface-format-version: 1.0
// swift-compiler-version: Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.17.14 clang-1700.3.17.1)
// swift-module-flags: -target arm64-apple-ios26.0-simulator -enable-objc-interop -autolink-force-load -enable-library-evolution -module-link-name swiftAssetsLibrary -swift-version 5 -enforce-exclusivity=checked -O -library-level api -enable-upcoming-feature InternalImportsByDefault -enable-upcoming-feature MemberImportVisibility -enable-experimental-feature DebugDescriptionMacro -enable-bare-slash-regex -user-module-version 802.43.254 -module-name AssetsLibrary
// swift-module-flags-ignorable:  -formal-cxx-interoperability-mode=off -interface-compiler-version 6.2
@_exported public import AssetsLibrary
public import Swift
public import _Concurrency
public import _StringProcessing
public import _SwiftConcurrencyShims
extension AssetsLibrary.ALAssetsLibrary {
  #if compiler(>=5.3) && $NonescapableTypes
  @available(iOS, introduced: 9.0, deprecated: 9.0, obsoleted: 26.0)
  @nonobjc public func enumerateGroupsWithTypes(_ types: Swift.UInt32, usingBlock enumerationBlock: AssetsLibrary.ALAssetsLibraryGroupsEnumerationResultsBlock!, failureBlock: AssetsLibrary.ALAssetsLibraryAccessFailureBlock!)
  #endif
}

Removing the AssetsLibrary import in react-native-compressor works for us too.

diminecjean avatar Sep 11 '25 02:09 diminecjean

Duplicate of #362, the patch does fix the build error

ChristopherGabba avatar Sep 16 '25 12:09 ChristopherGabba

fixing patch:

react-native-compressor+1.12.0.patch

RoiDayan1 avatar Sep 18 '25 08:09 RoiDayan1

The patch worked for me but now when I try to do a backgroundUpload using react native compressor, the app crashes on iOS :'( I'll start using expo-file-system from now on to do that

Daavidaviid avatar Sep 19 '25 18:09 Daavidaviid