I'm relatively new to iphone programming and am stuck on a very basic issue with variables. I want to access a string variable (delegateString for this example) declared and set in my apps delegate (AppDelegate) from a view controller. So I've tried both lines of code below in my view controller to access delegateString.
Both techniques work, and I can get the delegateString variable just fine in the view controller, but it's always empty. I'm sure I just don't understand how to do this. Any help is greatly appreciated, I've been stuck for two days.
Thanks in advance.
Code:
AppDelegate *mainDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *localString = mainDelegate.delegateString;
NSString *localString = [AppDelegate *)[UIApplication sharedApplication].delegate delegateString];
Both techniques work, and I can get the delegateString variable just fine in the view controller, but it's always empty. I'm sure I just don't understand how to do this. Any help is greatly appreciated, I've been stuck for two days.
Thanks in advance.