I got an error convert CFString. Error message is:
Cannot assign a value of type '[CFString]' to a value of type '[String].
How to fix?
picker.sourceType = UIImagePickerControllerSourceType.Camera
picker.allowsEditing = false
picker.mediaTypes = [kUTTypeImage] //Error Message : Cannot assign a value of type '[CFString]' to a value of type '[String]'
picker.delegate = self
picker.modalPresentationStyle = .Popover
presentViewController(picker, animated: true, completion: nil)//
From the header file:
public var mediaTypes: [String]
// default value is an array containing kUTTypeImage.
So you can actually just delete that line.
But if you want to keep it, you just need to be explicit that you want a cast:
picker.mediaTypes = [kUTTypeImage as String]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With