0

I'm trying to get the video URL (video chosen from user camera roll) from PHPickerview result, however I'm receiving this error: It's saying that it can't load representation of type public.movie, hence the file won't be opened since it doesn't exist. This only happens with larger video files. :/

I've already tried using different type identifiers, and it hasn't worked.

Error Domain=NSItemProviderErrorDomain Code=-1000 "Cannot load representation of type public.movie" UserInfo={NSLocalizedDescription=Cannot load representation of type public.movie, NSUnderlyingError=0x282932ca0 {Error Domain=NSCocoaErrorDomain Code=260 "The file couldn’t be opened because it doesn’t exist." UserInfo={NSFilePath=/private/var/mobile/Containers/Shared/AppGroup/E5CE1DB9-85C1-4378-94C2-D384E92C5268/File Provider Storage/photospicker/version=1&uuid=B42E6922-E10A-46DB-8B95-66B009F7294A&mode=compatible.mov, NSLocalizedDescription=The file couldn’t be opened because it doesn’t exist.}}}

result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.movie.identifier)
{ videoURL, error in
                    
  assert(Thread.isMainThread == false)

  let directory = NSTemporaryDirectory()
  let fileName = NSUUID().uuidString.appending(".mov")

  if let videoURL = videoURL,
    let copiedURLFile = NSURL.fileURL(withPathComponents: [directory, fileName]) {
2
  • Your code needs to check the error first, and print it out and then stop. Commented Sep 12, 2022 at 2:31
  • @matt my error is printing out, what do you mean? I want to know how to fix the error being presented in the print statement. Commented Sep 12, 2022 at 2:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.