I want to pass datum from view controller to view controller via tab bar controller.

I mean, my storyboard is like this.

View Controller → Tab Bar Controller → VC1/VC2/VC3

For the purpose of this, I tried to use PrepareforSegue, but it's failed.
The code is here.

(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{

NSIndexPath *selectedIndexPath = [self.tableView indexPathForSelectedRow];
friendsDetailViewController* vc = [[friendsDetailViewController alloc] init];
vc = (friendsDetailViewController*)[segue destinationViewController];
 
vc.candidateid = [[NSString alloc] init];
vc.candidateid = [candidateid objectAtIndex:selectedIndexPath.row];

Though I was trying to pass data from VC to VC1, SIGABT happened on the last line.


Update:

I've got figured out how. Here is the script:

friendsDetailViewController* vc = [[friendsDetailViewController alloc] init];
UITabBarController* tbc = [segue destinationViewController];
vc = (friendsDetailViewController*)[[tbc customizableViewControllers] objectAtIndex:0];

Firstly, I have to attach Tab Bar Controller.
Secondly, retrieve each View Controller's pointer.
You can select by using objectIndex.

Edit
Report