I'm trying to call a ViewController's segue from AppDelegate by using delegate. I want to make sure that the xmppRoster is stored before the segue is performed. There is an error that says:
"Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'segueForList''"
I'm sure segueForList is the correct segue identifier because the code
[self performSegueWithIdentifier:@"segueForList" sender:self] works when not using delegate.
The segue is built in a storyboard and connect to the ViewController, I can't post the image now cause my reputation is not enough,sorry
AppDelegate.h:
@protocol friendListSegue
- (void) ListSegue;
@end
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (assign,nonatomic) id<friendListSegue> delegate;
@end
In AppDelegate.m, this method will automatically be called when system finishes the storage:
- (void)xmppRosterDidEndPopulating:(XMPPRoster *)sender
{
ViewController * view0=[[ViewController alloc] init];
self.delegate = view0;
[self.delegate ListSegue];
NSLog(@"didStored");
}
ViewController.m:
- (void) ListSegue{
NSLog(@"segue_List");
[self performSegueWithIdentifier:@"segueForList" sender:self];
}