重複の可能性:
ポップオーバーがまだ表示されている間に UIPopovercontroller dealloc に達した
ユニバーサル アプリを作成し、カメラ ロールから選択した画像を取得しようとしています。iPhoneで正常に動作し、iPadはポップオーバーを望んでいるので、それを行ってもエラーが発生し続けます
-[UIPopoverController dealloc] reached while popover is still visible.
私は調査しました:
そしてグーグル、何もこの問題を解決していません
今立ち往生、アドバイスをいただければ幸いです
ポップオーバー デリゲートを .h に実装しました
.m
- (void)logoButtonPressed:(id)sender /////////////iPad requires seperate method ////////////////
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
////////
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
////////
[self presentModalViewController:imagePicker animated:YES];
}
else
{
// We are using an iPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
popoverController.delegate=self;
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
私も今これを試しました:
.h
@property (strong) UIPopoverController *pop;
.m
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { ///code added
LogCmd();
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
[self presentModalViewController:imagePicker animated:YES];
///code added////////////////////////////
}
else {
if (self.pop) {
[self.pop dismissPopoverAnimated:YES];
}
// If usingiPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];