diff --git a/packages/app/ios/RNFBApp/RNFBUtilsModule.m b/packages/app/ios/RNFBApp/RNFBUtilsModule.m index f43b9b67d0..6feb422d84 100644 --- a/packages/app/ios/RNFBApp/RNFBUtilsModule.m +++ b/packages/app/ios/RNFBApp/RNFBUtilsModule.m @@ -57,7 +57,16 @@ + (PHAsset *)fetchAssetForPath:(NSString *)localFilePath { if ([localFilePath hasPrefix:@"assets-library://"] || [localFilePath hasPrefix:@"ph://"]) { if ([localFilePath hasPrefix:@"assets-library://"]) { NSURL *localFile = [[NSURL alloc] initWithString:localFilePath]; +#if TARGET_OS_MACCATALYST + static BOOL hasWarned = NO; + if (!hasWarned) { + NSLog(@"assets-library:// URLs are not supported in Catalyst-based targets; returning nil (future warnings will be suppressed)"); + hasWarned = YES; + } + asset = nil; +#else asset = [[PHAsset fetchAssetsWithALAssetURLs:@[localFile] options:nil] firstObject]; +#endif } else { NSString *assetId = [localFilePath substringFromIndex:@"ph://".length]; asset = [[PHAsset fetchAssetsWithLocalIdentifiers:@[assetId] options:nil] firstObject]; @@ -91,4 +100,4 @@ - (NSDictionary *)constantsToExport { return constants; } -@end \ No newline at end of file +@end