转换CFString时出错。错误信息是:
无法将类型“ [CFString]”的值分配给类型“ [String]”的值。
怎么修?
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)//
从头文件:
public var mediaTypes: [String]
// default value is an array containing kUTTypeImage.
因此,您实际上可以删除该行。
但是,如果要保留它,则只需明确声明要强制转换:
picker.mediaTypes = [kUTTypeImage as String]
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句