diff --git a/packages/app/ios/RNFBApp/RNFBUtilsModule.m b/packages/app/ios/RNFBApp/RNFBUtilsModule.m index 6feb422d84..d3d4403b6f 100644 --- a/packages/app/ios/RNFBApp/RNFBUtilsModule.m +++ b/packages/app/ios/RNFBApp/RNFBUtilsModule.m @@ -57,16 +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)"); + if (@available(macOS 11, *) || @available(iOS 12, *)) { + static BOOL hasWarned = NO; + if (!hasWarned) { + NSLog(@"'assets-library://' & 'ph://' URLs are not supported in Catalyst-based targets or iOS 12 and higher; returning nil (future warnings will be suppressed)"); hasWarned = YES; + } + asset = nil; + } else { + asset = [[PHAsset fetchAssetsWithALAssetURLs:@[localFile] options:nil] firstObject]; } - 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]; diff --git a/packages/storage/ios/RNFBStorage/RNFBStorageCommon.m b/packages/storage/ios/RNFBStorage/RNFBStorageCommon.m index d54ee14f82..c94e5f54e2 100644 --- a/packages/storage/ios/RNFBStorage/RNFBStorageCommon.m +++ b/packages/storage/ios/RNFBStorage/RNFBStorageCommon.m @@ -79,6 +79,12 @@ + (void)NSURLForLocalFilePath:(NSString *)localFilePath completion:(void (^)( ))completion { if ([RNFBUtilsModule isRemoteAsset:localFilePath]) { PHAsset *asset = [RNFBUtilsModule fetchAssetForPath:localFilePath]; + + if (!asset) { + completion(@[@"asset-library-removed", @"iOS 'asset-library://' & 'ph://' URLs have been removed, please provide the correct path to resource."], nil, nil); + + return; + } NSURL *temporaryFileUrl = [RNFBStorageCommon createTempFileUrl]; [RNFBStorageCommon downloadAsset:asset toURL:temporaryFileUrl completion:^( NSArray *errorCodeMessageArray,