Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.")
    }
like image 518
Matthew Smith Avatar asked Aug 14 '15 20:08

Matthew Smith


Video Answer


1 Answers

Try casting the CFString to a String like so:

picker.mediaTypes = [kUTTypeImage as String]
like image 79
Cloud9999Strife Avatar answered Nov 02 '22 10:11

Cloud9999Strife