Swift - Is it possible to select a video from the library on the iOS simulator? -
all shows when use uiimagepickercontroller library of photos. have mp4 video saved simulator library, never shows in list when access simulator library programmatically uiimagepickercontroller. there i'm doing wrong?
based on swift 2.2
your code may this:
@ibaction func selectimagefromphotolibrary(sender: uibarbuttonitem) { let imagepickercontroller = uiimagepickercontroller() imagepickercontroller.sourcetype = .photolibrary imagepickercontroller.delegate = self imagepickercontroller.mediatypes = ["public.image", "public.movie"] presentviewcontroller(imagepickercontroller, animated: true, completion: nil) }
actually can answers apple document:
uiimagepickercontroller class reference
the useful method class func availablemediatypesforsourcetype
.
you can try this:
let types = uiimagepickercontroller.availablemediatypesforsourcetype(.photolibrary) print(types)
then know videos types named public.movie
, not kuttypemovie
anymore.
Comments
Post a Comment