Reputation: 279
I'm encountering an issue on iOS 18:
I use the following code to get the video path in the photos kit:
[PHImageManager defaultManager] requestAVAssetForVideo:asset options:videoOptions resultHandler:^(AVAsset * _Nullable asset, AVAudioMix * _Nullable audioMix, NSDictionary * _Nullable info) {
BOOL yesOrNo = [self isInCloudForInfo:info];
NSString *localPath = nil;
if (!yesOrNo && [asset isKindOfClass:[AVURLAsset class]]) {
localPath = [(AVURLAsset *)asset URL].absoluteString;
}
// Do something with localPath...
}]
When I use [[[NSFileManager defaultManager] fileExistsAtPath:localPath]
, it returns NO. Also, the .duration
of the AVURLAsset
init with localPath
returns 0, but this video can be played via AVPlayer
.
When I get localPath
by localPath = [(AVURLAsset *)asset URL].relativePath
, and [[NSFileManager defaultManager] fileExistsAtPath:localPath]
returns YES, but the AVURLAsset
can't play the video with "You don't have permission." error.
How can I resolve is?
Here are some links I found on Google that might be relevant:
Must I use Photos Kit
? If so, I'll need to make significant changes to adapt to iOS18
Upvotes: 0
Views: 219