Skip to content

Commit 86f1f63

Browse files
authored
fix(app, ios): avoid photo API not present on Catalyst (#4328)
1 parent cbd1eba commit 86f1f63

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/app/ios/RNFBApp/RNFBUtilsModule.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ + (NSString *)valueForKey:(NSString *)key fromQueryItems:(NSArray *)queryItems {
5252
}
5353

5454
+ (PHAsset *)fetchAssetForPath:(NSString *)localFilePath {
55-
PHAsset *asset;
55+
PHAsset *asset = nil;
5656

5757
if ([localFilePath hasPrefix:@"assets-library://"] || [localFilePath hasPrefix:@"ph://"]) {
5858
if ([localFilePath hasPrefix:@"assets-library://"]) {
@@ -63,9 +63,10 @@ + (PHAsset *)fetchAssetForPath:(NSString *)localFilePath {
6363
NSLog(@"'assets-library://' & 'ph://' URLs are not supported in Catalyst-based targets or iOS 12 and higher; returning nil (future warnings will be suppressed)");
6464
hasWarned = YES;
6565
}
66-
asset = nil;
6766
} else {
67+
#if (!TARGET_OS_MACCATALYST)
6868
asset = [[PHAsset fetchAssetsWithALAssetURLs:@[localFile] options:nil] firstObject];
69+
#endif
6970
}
7071
} else {
7172
NSString *assetId = [localFilePath substringFromIndex:@"ph://".length];

0 commit comments

Comments
 (0)