Matthew Smith
Matthew Smith

Reputation: 51

Cannot assign a value of type '[CFString]' to a value of type '[String]'

I just downloaded the new Xcode 7 beta 5 and I cannot find a way to resolve this error. It keeps highlighting the line "pickker.mediaTypes = [kUTTypeImage]" and says "Cannot assign a value of type '[CFString]' to a value of type '[String]'"

if (UIImagePickerController.isSourceTypeAvailable(UIImagePickerControllerSourceType.Camera)){
        let picker = UIImagePickerController()
        picker.delegate = self
        picker.sourceType = UIImagePickerControllerSourceType.Camera
        picker.mediaTypes = [kUTTypeImage]
        picker.allowsEditing = true
        self.presentViewController(picker, animated: true, completion: nil)
    }
    else{
        NSLog("No Camera.")
    }

Upvotes: 5

Views: 1018

Answers (1)

Cloud9999Strife
Cloud9999Strife

Reputation: 3202

Try casting the CFString to a String like so:

picker.mediaTypes = [kUTTypeImage as String]

Upvotes: 10

Related Questions