Jaume
Jaume

Reputation: 923

empty vars when method is called from another class

On main delegate, I am executing some functions and getting some results for the variables. Then, I am calling from main delegate a function of another class viewController1. It is been executed properly but then, when I need to callback from viewController1 to appDelegate, I create an instance:

AppDelegate *theInstance = [[AppDelegate alloc] init];

[AppDelegate composeBar:YES];

ComposeBar is properly called but then, most of variables, that were set at the beggining, are empty! Vars are retained allocated and synthezised but when callback are empty!

Upvotes: 1

Views: 53

Answers (1)

Roman Temchenko
Roman Temchenko

Reputation: 1806

You should not alloc another instance of your appDelegate. If you want to access it you can use [[[UIApplication sharedApplication] delegate] composeBar:YES];

Upvotes: 4

Related Questions