nblandfo
nblandfo

Reputation: 41

No visible interface for UIImagePickerController declares the selector isSourceTypeAvailable

I'm trying to use an UIImagePickerController to capture some photos in my app. I created a UIImagePickerController object and it's telling me

"isSourceTypeAvailable:" is not a method. 

Is there something I need to import or something along those lines? I've added MobileCoreServices to my framework library (not sure why) and tried importing " in my header file. Anything I'm missing?

Upvotes: 0

Views: 147

Answers (1)

rmaddy
rmaddy

Reputation: 318854

The isSourceTypeAvailable: method is a class method, not an instance method. Call it like this:

if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
}

instead of calling the method on your image picker instance.

If you look at the reference docs for isSourceTypeAvailable: you can see it is a class method because it has a + instead of -.

Upvotes: 2

Related Questions