Q:

How to make variable accessible in the appDelegate and/or other view controllers?

I have a boolean variable that I need to access in my appDelegate, but I can't figure out how to do so. I have tried to import the other view controller and then implement it, but it comes up with an Apple Mach-O linker (id) error that says "Linker command failed with an exit code 1". I am fairly new to app dev, so please explain it in simple terms.  I am using storyboards, so I can't combine xib/nib files with my code.

A:

Yon can declare a property in your MyAppDelegate.h:
@property (strong, nonatomic) NSString *myString;

Then you can access it in your ViewController:
#import "MyAppDelegate.h"
...
MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"%@", appDelegate.myString);

