我该如何进行编译?

在此功能的第二行:

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!)'

最佳答案

UITypeEqual返回Boolean,而不是Bool。处理Boolean的最简单方法是将其与0进行比较。

    if UTTypeEqual(mediaType, kUTTypeJPEG) != 0 {

10-07 23:04