1

I am using the following code:

func addAttachmentUtil() {
    print("file attacher")
    let file = UIImagePickerController()
    file.delegate = self

    file.sourceType = UIImagePickerControllerSourceType.photoLibrary

    file.mediaTypes = ["public.image", "public.movie"]
    file.videoMaximumDuration = 5.0

    file.allowsEditing = false

    self.present(file, animated: true)
    {
    }
}

However I also want to limit the file on the basis of size (which would be 25 MB). I am not able to understand how to do this? Help is much appreciated.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Enrik Qaz
  • 243
  • 4
  • 14

1 Answers1

0

You cannot limit what’s displayed or prevent the user from choosing a bigger video. After the user chooses, you can look at the file and decide to do nothing with it.

matt
  • 515,959
  • 87
  • 875
  • 1,141