设置选取器视图的委托时,我收到此警告:
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)
我已经注册了代表:
@interface PhotoBrowser : UIViewController <UIImagePickerControllerDelegate,UINavigationBarDelegate>
也尝试过:
@interface PhotoBrowser : UIImagePickerController <UIImagePickerControllerDelegate,UINavigationBarDelegate>
1-错误不会消失..
2-如何以及何时向用户请求许可?我以某种方式找不到打开该库并选择图像的简单指南。
最佳答案
是不是UINavigationControllerDelegate
而不是UINavigationBarDelegate
吗?
当您尝试打开图像选择器时,iOS系统会自动处理向用户询问权限的事情。它会显示一个警报弹出窗口。
关于ios - UIImagePickerController委托(delegate)警告?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23855531/