I have a TopicsViewController which displays UIButtons labeled by popular research topics for students.
TopicsViewController:
TopicsViewController.m has a prepareForSegue method successfully passing data to my StatsViewController, which displays UIButtons labeled by statistics for the selected topic. These statistics are NSStrings passed from the TopicsViewController class into NSString properties in the StatsViewController class.
In TopicsViewController.m:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@"abortionSeg"]) {
StatsViewController *statScreen = [segue destinationViewController];
NSString *abortStatistic1 = @"this is a stat", *abortStatistic2 = @"this is a stat", *abortStatistic3 = @"this is a stat", *abortStatistic4 = @"this is a stat", *abortStatistic5 = @"this is a stat", *abortStatistic6 = @"this is a stat", *abortStatistic7 = @"this is a stat", *abortStatistic8 = @"more stats to come";
statScreen.strStat1 = abortStatistic1;
statScreen.strStat2 = abortStatistic2;
statScreen.strStat3 = abortStatistic3;
statScreen.strStat4 = abortStatistic4;
statScreen.strStat5 = abortStatistic5;
statScreen.strStat6 = abortStatistic6;
statScreen.strStat7 = abortStatistic7;
statScreen.strStat8 = abortStatistic8;
statScreen.statWhichTopic = @"abortion";
}
else if ([segue.identifier isEqualToString:@"agricultSeg"]) {...}
StatsViewController:
StatsViewController.m has a prepareForSegue method successfully passing data to my CiteViewController, which displays UIButtons labeled by MLA and APA citations for the selected statistic. These citations are passed in the same way as the statistics are from one class to another.
In StatsViewController.m:
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
//stat1 data... COMPLETE
if ([segue.identifier isEqualToString:@"stat1Seg"]) {
CiteViewController *citeScreen = [segue destinationViewController];
citeScreen.citeWhichStat = @"1";
if ([statWhichTopic isEqualToString:@"abortion"]) {
citeScreen.strMLA = @"Mantel, Barbara. \"Abortion.\" CQ Researcher 19 May 2015. Web. 4 Mar. 2016.";
citeScreen.strAPA = @"Mantel, B. (2015, May 19). Abortion. CQ Researcher. Retrieved from http://library.cqpress.com.ezaccess.libraries.psu.edu/";
citeScreen.citeWhichTopic = @"abortion";
}
else if ([statWhichTopic isEqualToString:@"agriculture"]) {..}
CiteViewController:
The Cite page then passes a URL on to a SourceViewController to display a UIWebView associated with the source, but there are no issues with this page.
Issues:
When tapping the “< Hot Topics” button on the Stats page (segues back to TopicsViewController), the app crashes and the exception breakpoint falls on the following line:
The debugger shows the UIButtons on TopicsViewController are nil:
When tapping the “< Statistics” button on the Cite page (segues back to StatsViewController), the app crashes and the exception breakpoint falls on the following line:
The debugger shows the NSStrings on StatsViewController are nil:
This is all I have found. Thank you in advance for any replies, much appreciated.