I am attempting to pass data between two view controllers via tabBar.
VC1 = search controller.
Search using a string, obtain array of results.
It is located on tab 1.
It has a navigation controller, and VC1 is the root.
VC2 = Results controller.
Display results from VC1.
It is located on tab 2.
It has a navigation controller and VC2 as root.
(each tab has this architecture, Nav Controller = then a VC as the root).
I was previously using protocol and delegates in the prepare for segue (great but not using tabs).
So I now have a segue from a button in VC1 (to load the results in VC2) to the tab bar.
I am attempting to pass the info using prepareForSegue, and then adding the code below in this method
(after identifying the correct segue).
However app crashes, and I’m not sure I’m doing this correctly.
ResultsIndexViewController* vc = [[ResultsIndexViewController alloc] init];
UITabBarController* tbc = [segue destinationViewController];
vc = (ResultsIndexViewController *)[[tbc customizableViewControllers] objectAtIndex:1];
vc.SearchDelegate=self;//crash here (normally works if using regular segue)
vc.resultsArray = _temporaryResultsArray;
vc.originalQuery=_queryArray;
I ended up not using this code. Instead I used the delegate created by the tabbar to get information. I am posting the steps in a separate question, which I will link below