设置选择器视图的委托时,我收到此警告:
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-我如何以及何时要求用户许可?我在某种程度上找不到一个简单的指南来打开这个库并选择图像。
答案 0 :(得分:1)
是不是UINavigationControllerDelegate
而不是UINavigationBarDelegate
?
当您尝试打开图像选择器时,iOS系统会自动处理询问用户的权限事项。它会显示一个警告弹出窗口。