Question: I am trying to add two variabled in my appDelegate so that I can use them in other my view controller.

My code looks like this:

myappdelegate.h:

```
@class MyViewController1, MyViewController2; // controller than use my new variables

@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
    NSString* firstVariable; 
    NSString* secondVariable; 
}
@property (retain) NSString* firstVariable;
@property (retain) NSString* secondVariable;

@end

```

In myappdelegate.m I synthesized the variables:

```
...
@synthesize firstVariable = _firstVariable;
@synthesize secondVariable = _secondVariable;
...

```

But when in my viewcontroller use myappdelegate don't find my new variables:

```
...
mainDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
...
mainDelegate.firstVariable = localVariable.text;
...

```

where is my error??

Thanks to all.

Answer: 
Get rid if your instance variables and your @synthesize statement. The compiler will do that work for you.

Make sure you `#import AppDelegate.h` every place you need it, particularly in MyViewController1.m and MyViewController2.m.

My guess is that you didn't import the AppDelegate.h file in your view controller's .m files.

As @Abizern says, using the app delegate to pass data is not a good design pattern. You should keep your app delegate simple, only responding to delegate messages and notifications. 

Better to create a data container singleton and use that to share data between objects in your project.
```
Code:
@interface AppDelegate : UIResponder <UIApplicationDelegate>
{
    NSString* firstVariable;
    NSString* secondVariable;
}
@property (retain) NSString* firstVariable;
@property (retain) NSString* secondVariable;

@implementation AppDelegate

@synthesize firstVariable;
@synthesize secondVariable;

Inside your View Controller :

#import "AppDelegate.h"

@interface ViewController : UIViewController{
AppDelegate *mainDelegate;
}

#import "AppDelegate.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    mainDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    NSLog(@"Vars are :%@ , %@",mainDelegate.firstVariable,mainDelegate.secondVariable);
}

```