Iphone iOS崩溃:respondsToSelector:消息已发送到解除分配的实例
我使用Iphone iOS崩溃:respondsToSelector:消息已发送到解除分配的实例,iphone,objective-c,ios7,crash,crash-reports,Iphone,Objective C,Ios7,Crash,Crash Reports,我使用UINavigationController作为rootviewController和故事板序列来推动viewcontroller。我的应用程序中有许多ViewController。我只使用推送视图控制器传递它们 崩溃场景:(可以重现) 我有一个产品列表viewController,当我使用点击手势识别器点击列表中的产品时,我将导航到产品详细信息viewController。 从详细视图控制器,我将被推到购物车项目视图控制器,当我点击名为“添加到购物车”的按钮时,它将显示所有选定的产品。
UINavigationController
作为rootviewController
和故事板序列来推动viewcontroller。我的应用程序中有许多ViewController。我只使用推送视图控制器传递它们
崩溃场景:(可以重现)modalViewController
,当我选择联系人时,它会崩溃我已经包括了使我崩溃的方法。但我从未尝试从任何控制器调用该方法李> 代码…
//choosing contact and people picker delegate
- (IBAction) chooseContacts: (id) sender {
picker = [
[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
[self presentViewController: picker animated: YES completion: nil];
}
#pragma mark - Addressbook delegate methods
- (void) peoplePickerNavigationControllerDidCancel: (ABPeoplePickerNavigationController * ) peoplePicker {
[self dismissViewControllerAnimated: YES completion: nil];
}
- (BOOL) peoplePickerNavigationController: (ABPeoplePickerNavigationController * ) peoplePicker
shouldContinueAfterSelectingPerson: (ABRecordRef) person {
[self dismissViewControllerAnimated: YES completion: ^ {
[self displayPerson: person];
}];
return NO;
}
以下方法中的行performsguewithidentifier
发生崩溃
#pragma mark- Tap gesture delegates
-(void)tapGestureFirstImage:(UITapGestureRecognizer *)sender
{
UIImageView *image = (UIImageView *)sender.view;
if (image.tag < [_productsArray count]) {
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
productDetailDictionary = [_productsArray objectAtIndex:image.tag];
NSLog(@"%@",productDetailDictionary);
[self performSegueWithIdentifier:@"productDetailSeague" sender:sender];
}
NSLog(@"imageView.Tag %ld",(long)image.tag);
}
感谢您的帮助。关于-(无效)点击GestureFirstImage:(UITapGestureRecognitizer*)发件人
你和我一起表演这一段
[self-PerformsgueWithIdentifier:@“ProductDetailsAgue”发件人:发件人]代码>
但是我认为发送者应该是self
,而不是sender
更新
当选择器处于活动状态时,您是否尝试执行segue?在这种情况下,self
可能会被解除分配,因此您可以在picker
被解除后尝试执行segue:
[picker dismissViewControllerAnimated:YES completion:^{[self performSegueWithIdentifier:@"productDetailSeague" sender:self];}];
你能给我看一下飞机失事的样子吗?我也这么想。甚至是nil
。我会试试这个,然后告诉你。@Logunath你真的需要把崩溃日志放在你的问题里。没有它,我们都只是猜测!伙计们,用情节提要标识符而不是PerformSegueWithIdentifier和presentModalViewController来推动控制器不会造成任何崩溃。仅显示控制器崩溃。
[picker dismissViewControllerAnimated:YES completion:^{[self performSegueWithIdentifier:@"productDetailSeague" sender:self];}];