Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS崩溃:respondsToSelector:消息已发送到解除分配的实例_Iphone_Objective C_Ios7_Crash_Crash Reports - Fatal编程技术网

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。我只使用推送视图控制器传递它们

崩溃场景:(可以重现)

  • 我有一个产品列表viewController,当我使用点击手势识别器点击列表中的产品时,我将导航到产品详细信息viewController。
  • 从详细视图控制器,我将被推到购物车项目视图控制器,当我点击名为“添加到购物车”的按钮时,它将显示所有选定的产品。
  • 如果我尝试为所有我想从联系人选取器中选择联系人的产品付费,当我按下“付费”按钮时,它会将联系人选取器控制器显示为
    modalViewController
    ,当我选择联系人时,它会崩溃
  • 只有在从产品列表视图控件移动到peoplepicker控件时才会发生崩溃。当我使用该工具进行调试时,我收到了一条崩溃消息,说释放实例接收消息
    我已经包括了使我崩溃的方法。但我从未尝试从任何控制器调用该方法 代码…

    //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];}];