Мне нужна помощь в определении этого сбоя. Я проверил stackoverflow для ответов, но не ответы касаются моей ситуации. Это мой код.iOS Crash: Завершение приложения из-за непонятой причины исключения: UIPopoverPresentationController должен иметь не-ниль источник Source
- (void)addImagesActionSheetClickedButtonAtIndex:(NSInteger)buttonIndex
{
// Cancel
if (buttonIndex == 2) return;
//Take picture
if (buttonIndex == 0)
{
//Take picture
isFromLibrary = NO;
[self.imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[self.navigationController presentViewController:self.imagePicker animated:YES completion:NULL];
return;
}
// Library picture
if (buttonIndex == 1)
{
if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeSavedPhotosAlbum]) return;
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:self.imagePicker];
[popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0)inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
Если я нажимаю кнопку индекса 1 и увольнять UIPopoverController
затем нажмите кнопку индекс 0, чтобы сделать снимок мое приложение падает.
Вот мой отчет аварии
«Нагрузочного приложение из-за неперехваченное исключение„NSGenericException“, причины:» UIPopoverPresentationController () должен иметь не нулевую SourceView или barButtonItem установить до возникновения презентации.
Любые предложения или советы приветствуются. Если мне нужно разместить больше кода, пожалуйста, дайте мне знать.