Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHImageResultIsDegradedKey/PHImageFileURLKey is not found

iOS 13 beta4 no longer gives

1) PHImageFileURLKey 2) PHImageResultIsDegradedKey in image result info keys.

Anyone knows a way to find the fileurl of the PHAsset?

like image 903
guhan0 Avatar asked Jul 25 '19 13:07

guhan0


2 Answers

You have to use this function from PHAsset object:

- (PHContentEditingInputRequestID)requestContentEditingInputWithOptions:(nullable PHContentEditingInputRequestOptions *)options completionHandler:(void (^)(PHContentEditingInput *__nullable contentEditingInput, NSDictionary *info))completionHandler;

Then you can retrieve URL this way:

NSURL *url = contentEditingInput.fullSizeImageURL;
like image 105
Slyv Avatar answered Oct 26 '22 06:10

Slyv


Some example Objective-C code for anyone else looking for it:

PHContentEditingInputRequestOptions *editOptions = [[PHContentEditingInputRequestOptions alloc] init];

[myPHAsset requestContentEditingInputWithOptions:editOptions completionHandler:^(PHContentEditingInput *contentEditingInput, NSDictionary *info) {

    if (contentEditingInput.fullSizeImageURL) {
        //do something with contentEditingInput.fullSizeImageURL
    }

}];
like image 34
AEQ Avatar answered Oct 26 '22 05:10

AEQ