Skip to content

Commit 4e3b4b7

Browse files
committed
add support for fetching assets with local identifiers in copyAssetsFileIOS
1 parent 3bc8e39 commit 4e3b4b7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ android/*.iml
2929
android/local.properties
3030
android/.settings
3131
android/.project
32+
Session.vim

RNFSManager.m

+6-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,12 @@ + (BOOL)requiresMainQueueSetup
737737
CGSize size = CGSizeMake(width, height);
738738

739739
NSURL* url = [NSURL URLWithString:imageUri];
740-
PHFetchResult *results = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
740+
PHFetchResult *results = nil;
741+
if ([url.scheme isEqualToString:@"ph"]) {
742+
results = [PHAsset fetchAssetsWithLocalIdentifiers:@[url] options:nil];
743+
} else {
744+
results = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
745+
}
741746

742747
if (results.count == 0) {
743748
NSString *errorText = [NSString stringWithFormat:@"Failed to fetch PHAsset with local identifier %@ with no error message.", imageUri];

0 commit comments

Comments
 (0)