Curnelious
Curnelious

Reputation: 1

UIImagePickerController delegate warning?

I am getting this warning when setting the delegate of a picker view:

 UIImagePickerController *pickerLibrary = [[UIImagePickerController alloc] init];
    pickerLibrary.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    pickerLibrary.delegate = self;
    [self presentViewController:pickerLibrary animated:YES completion:nil];



warning : assigning to <UIImagePickerControllerDelegate,UINavigationBarDelegate> from incompatible type "photoBrowser(my class name) 

I have registered to the delegates:

@interface PhotoBrowser : UIViewController <UIImagePickerControllerDelegate,UINavigationBarDelegate>

Tried also:

@interface PhotoBrowser : UIImagePickerController <UIImagePickerControllerDelegate,UINavigationBarDelegate>

1-The error don't go away ..

2- How and when do I ask the user for permission? I somehow couldn't find 1 simple guide to open this library and choose image.

Upvotes: 0

Views: 70

Answers (1)

Zhang
Zhang

Reputation: 11607

Wasn't it UINavigationControllerDelegate instead of UINavigationBarDelegate?

The ask user for permission thing is automatically handled by iOS system when you try to open the image picker. It'll show an alert popup.

Upvotes: 1

Related Questions