'You don’t have permission. - The AVPlayerItem instance has failed with the error code 257 and domain "NSCocoaErrorDomain".'

[[PHImageManager defaultManager]
requestAVAssetForVideo:asset
       options:videoOptions
 resultHandler:^(AVAsset *_Nullable avAsset,
                 AVAudioMix *_Nullable audioMix,
                 NSDictionary *_Nullable info) {
   if ([avAsset isKindOfClass:[AVURLAsset class]]) {
     AVURLAsset *urlAsset = (AVURLAsset *)avAsset;

     NSURL *videoURL = urlAsset.URL;

     mediaInfo[@"path"] = videoURL.absoluteString;

   } else {
     // Failed to get video asset

     completion(nil);
   }
 }];```


Before iOS 18, i could able access AVAsset video using the method mentioned above with the url, but starting from the iOS 18 version, the following error appears

'You don’t have permission. - The AVPlayerItem instance has failed with the error code 257 and domain "NSCocoaErrorDomain".'
Answered by ERAppDeveloper in 807574022

This ticket can be closed since the issue resolve by just restarting the physical device since its was occurring in this

Hello @ERAppDeveloper,

Could you provide a sample project that reproduces the issue?

Thanks,

Greg

Accepted Answer

This ticket can be closed since the issue resolve by just restarting the physical device since its was occurring in this

'You don’t have permission. - The AVPlayerItem instance has failed with the error code 257 and domain "NSCocoaErrorDomain".'
 
 
Q