I am using [[UIApplication sharedApplication] delegate] to share a variable across several classes. I set the value in the AppDelegate. I am able to NSLog it from the myAppDelegate.m and see the value. Then I try to NSLog the value when one of my Tabs loads, and it crashes:
myAppDelegate *app = (myAppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"Value:%@ ", app.delegateVar); // <--- Causes Crash
Basically seems like it is creating a new instance of app.delegateVar ?
delegateVar is defined in myAppDelegate.h and then it myAppDelegate.m I do this:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
...
[delegateVar release];
delegateVar = [NSString stringWithFormat:@"Test Value"];
NSLog(@"%@",delegateVar);
...
}