如何在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
}
}
模式匹配運算 –