简体   繁体   中英

performSegueWithIdentifier gives me NSInvalidArgumentException

I'm trying to make a simple TabBar-based app with a center button to take a picture, add a comment and upload it (like dozens of other apps).

So far, I got the camera stuff working in a custom view controller (MSPickPhotoViewController) as one of my tab bar items and now I want to hand it over to NavigationController allowing to enter some information and to upload the photo to a server. I'm using a storyboard and tried using a segue from my MSPickPhotoViewController to the navigation controller. I gave the segue an identifier 'addPhoto' which i call by:

[self performSegueWithIdentifier:@"addPhoto" sender:self];

I also implemented the following in MSPickPhotoViewController to hand over the photo taken before:

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([[segue identifier] isEqualToString:@"addPhoto"]) {
        MSPostPhotoViewController *vc = [segue destinationViewController];  
        vc.image.image = self.image;
    }
}

I'm always getting the exception

'NSInvalidArgumentException', reason: 'Receiver (<MSPickPhotoViewController: 0x189770>) has no segue with identifier 'addPhoto''

The MSPickPhotoViewController itself has no button, it just opens an action sheet to select whether to take a photo or select one from the library and should hand it over.

Any suggestions?

Greetings, Björn

Ok, got it:

  1. It's always good to delete the app on the iphone Before running again. The storyboard was never refreshed.
  2. Finally the segue performed (as i could see by the log), but i forgot to hide rhe modal UiImagePickerController and didn't see the next view.

Still learning...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM