'EXC_BAD_ACCESS code=2' 尝试将对象从 VC 设置为另一个对象时发生错误

'EXC_BAD_ACCESS code=2' Error happens when trying to set an object from a VC to another one

假设我有一个 2 ViewController:A 和 B。

这是A的一些代码:

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
CategoryVC *vc = [storyboard instantiateViewControllerWithIdentifier:@"categoryVC"];
PParser *destPP = [[PParser alloc] init];
[destPP initWithFullURL:@"http://someurl.com"];
//setPp gives the Error EXC_BAD_ACCESS
[vc setPp:destPP];
SWRevealViewControllerSeguePushController *segue = [[SWRevealViewControllerSeguePushController alloc] initWithIdentifier:@"ANY_ID" source:self destination:vc];
[segue perform];

这是 B 的一些代码:

-(void)setPp:(PParser *)pp{
    self.pp = pp;
}

我猜这个错误与指针设置不正确有关?为什么会出现这个错误,我应该如何解决它?

试试这个:

-(void)setPp:(PParser *)pp  
{
  _pp = pp;
}