我试图让我的 imagePicker 从我的 sourceLibrary 加载照片。使用以下代码,应用程序崩溃并显示以下消息“应用程序试图以模态方式呈现活动控制器”
-(void)viewPhotoLibrary{
NSLog(@"get photos");
UIImagePickerController *imagePickerController =
[[UIImagePickerController alloc] init];
UIPopoverController *pop = [[UIPopoverController alloc]
initWithContentViewController:imagePickerController];
pop.delegate = self;
[pop setPopoverContentSize:CGSizeMake(500, 500)];
[pop presentPopoverFromRect:
CGRectMake(0, 0, 500, 500)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
[imagePickerController setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePickerController setDelegate:self];
[imagePickerController setModalPresentationStyle:UIModalPresentationFullScreen];
[self presentViewController:imagePickerController animated:YES completion:nil];
}