I have two UIViewController's. In the view1, i manage annotations with PINs, so i need to push the view2 exactly when the user click on the accessory control, my code is this:

-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
    NSLog(@"calloutAccessoryControlTapped");
    [self performSegueWithIdentifer:@"My identifier" sender:self];
}

When compiling, i got this warning:

Instance method '-performSegueWithIdentifer:sender:' not found (return type defaults to 'id')

And when running, the app obviously crashes with this stack:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[view1 performSegueWithIdentifer:sender:]: unrecognized selector sent to instance 0x7d94ca0'

In the storyboard, i selected the view1, ctrl+left click+ drop to view2, then i chooses push. Also, i have setted the segue identifier to My identifier. So what am i missing here?

有帮助吗?

解决方案

"performSegueWithIdentifer" has a typo. There's a letter 'i' missing. Try "performSegueWithIdentifier".

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top