Skip to content

Commit

Permalink
fix(app, ios): avoid photo API not present on Catalyst (#4328)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Sep 30, 2020
1 parent cbd1eba commit 86f1f63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/app/ios/RNFBApp/RNFBUtilsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ + (NSString *)valueForKey:(NSString *)key fromQueryItems:(NSArray *)queryItems {
}

+ (PHAsset *)fetchAssetForPath:(NSString *)localFilePath {
PHAsset *asset;
PHAsset *asset = nil;

if ([localFilePath hasPrefix:@"assets-library://"] || [localFilePath hasPrefix:@"ph://"]) {
if ([localFilePath hasPrefix:@"assets-library://"]) {
Expand All @@ -63,9 +63,10 @@ + (PHAsset *)fetchAssetForPath:(NSString *)localFilePath {
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 {
#if (!TARGET_OS_MACCATALYST)
asset = [[PHAsset fetchAssetsWithALAssetURLs:@[localFile] options:nil] firstObject];
#endif
}
} else {
NSString *assetId = [localFilePath substringFromIndex:@"ph://".length];
Expand Down

1 comment on commit 86f1f63

@vercel
Copy link

@vercel vercel bot commented on 86f1f63 Sep 30, 2020

Choose a reason for hiding this comment

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

Please sign in to comment.