in my MainViewController implementation, I need to access variables from two different classes. one of the classes is the AppDelegate and the other is the FlipsideViewController. the way I accessed these was through this code:
-(void)someMethod
{
MyApplicationAppDelegate *appDelegate = (MyApplicationAppDelegate *)[[UIApplication sharedApplication] delegate];
FlipsideViewController *viewController = (FlipsideViewController *)[[UIApplication sharedApplication] delegate];
then I have an array I access from my application delegate, and some instance variables that return values from an instance of UISwitch from the flipsideViewController:
NSMutableArray* array = [[NSMutableArray alloc] initWithArray:(NSMutableArray *)appdelegate.originalArray];
for (id element in array)
{
if ([[element attribute] isEqualToString:@"someAttribute"] && [viewController.switch1 isOn] == YES)
{
//preform function
}
}
I keep getting the error message "-[MyApplicationAppDelegate switch1]: unrecognized selector sent to instance. terminating app due to uncaught exception"