ma11hew28
ma11hew28

Reputation: 126357

Cannot invoke 'UTTypeEqual' with an argument list of type '(CFString!, CFString!)'

How do I get this to compile?

On the second line of this function:

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
    let mediaType = info[UIImagePickerControllerMediaType] as! CFString!
    if UTTypeEqual(mediaType, kUTTypeJPEG) {
        println("jpg")
    }
}

I get the compilation error:

Cannot invoke 'UTTypeEqual' with an argument list of type '(CFString!, CFString!)'

Upvotes: 0

Views: 106

Answers (1)

Rob Napier
Rob Napier

Reputation: 299345

UITypeEqual returns Boolean, not Bool. The easiest way to deal with Boolean is to compare it to 0.

    if UTTypeEqual(mediaType, kUTTypeJPEG) != 0 {

Upvotes: 1

Related Questions