Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app,ios): Build fails when targeting Mac (Project Catalyst) #3840

Merged
merged 1 commit into from
Jun 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/app/ios/RNFBApp/RNFBUtilsModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -91,4 +100,4 @@ - (NSDictionary *)constantsToExport {
return constants;
}

@end
@end