如何编译?
在此功能的第二行:
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
let mediaType = info[UIImagePickerControllerMediaType] as! CFString!
if UTTypeEqual(mediaType, kUTTypeJPEG) {
println("jpg")
}
}
我收到编译错误:
Cannot invoke 'UTTypeEqual' with an argument list of type '(CFString!, CFString!)'
答案 0 :(得分:1)
UITypeEqual
返回Boolean
,而不是Bool
。处理Boolean
的最简单方法是将其与0进行比较。
if UTTypeEqual(mediaType, kUTTypeJPEG) != 0 {