Post

Replies

Boosts

Views

Activity

Reply to Can you retrieve the PHAsset using the New Photo Picker?
It would be a good opportunity to reconsider if the app really needs direct Photos Library access or can work with just the image and video data. Is there any way to get the creation date of a video in the Photos Library without having direct access to it? The creation date of the picked result is not necessarily the same. Examples in a github project: https://github.com/Jan-E/ikyle.me-code-examples/blob/master/Photo%20Picker%20ObjC/Photo%20Picker%20ObjC/PHPickerController.m#L223
Dec ’20
Reply to Can you retrieve the PHAsset using the New Photo Picker?
The Objective-C way to get the assetIdentifier would be something like (void)selectPressed:(id)sender{ &#9;&#9;PHPhotoLibrary *photoLibrary = [PHPhotoLibrary sharedPhotoLibrary]; &#9;&#9;PHPickerConfiguration *config = [[PHPickerConfiguration alloc] initWithPhotoLibrary: photoLibrary]; &#9;&#9;config.selectionLimit = 1; &#9;&#9;config.filter = [PHPickerFilter videosFilter]; &#9;&#9;PHPickerViewController *pickerViewController = [[PHPickerViewController alloc] initWithConfiguration:config]; &#9;&#9;pickerViewController.delegate = self; &#9;&#9;[self presentViewController:pickerViewController animated:YES completion:nil]; } (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results{ &#9;&#9;[picker dismissViewControllerAnimated:YES completion:nil];&#9; &#9;&#9;for (PHPickerResult *result in results) { &#9;&#9;&#9;&#9;NSArray *assetIdentifiers = @[result.assetIdentifier]; &#9;&#9;&#9;&#9;PHFetchResult *assetResults = [PHAsset fetchAssetsWithLocalIdentifiers:assetIdentifiers options:nil]; &#9;&#9;&#9;&#9;// Do something with the assetResults if you have Photos Library access &#9;&#9;} }
Dec ’20