如何在UIImagePickerControllerMediaType
上使用switch语句?如何在UIImagePickerControllerMediaType上使用switch语句?
下面的示例引发的怪编译器错误:
Expression pattern of type 'CFString' cannot match values of type 'CFString'.
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
switch info[UIImagePickerControllerMediaType] as! CFString {
case kUTTypeImage:
break
default:
break
}
}
模式匹配运算 –