我得到一个错误转换CFString.错误信息是:
Cannot assign a value of type ‘[CFString]’ to a value of type ‘[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]