thanks mr. Kochan for your reply!
I tried to do this, but my application goes to crash without any error message in console

here is what I made:
created class named MyModel with session_id and others properties
then I went to my application delegate class and created new class attribute named "model":
@interface DelegateTestAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
IBOutlet UITabBarController *rootController;
MyModel *model;
}
and two methods to set/get this property:
- (MyModel *)getModel {
return model;
}
- (void) setModel: (MyModel *)newModel {
model = newModel;
}
then I tried to create two ViewController's to test it, in first I set MyModel property of delegate
first ViewController
- (void)viewDidLoad {
[super viewDidLoad];
DelegateTestAppDelegate *delegate = (DelegateTestAppDelegate *) [[UIApplication sharedApplication] delegate];
MyModel *model = [[MyModel alloc] init];
(.. set some properties of model ..)
[delegate setModel:model];
[model release];
}
In second ViewController i get MyModel from delegate:
- (void)viewDidLoad {
[super viewDidLoad];
MyModel *model;
DelegateTestAppDelegate *delegate = (DelegateTestAppDelegate *) [[UIApplication sharedApplication] delegate];
model = [delegate getModel];
}
when first controller loaded, application works fine. but when second controller loaded -- it crashes. where am I wrong?
ps. thanks for awesome obj-c 2.0 book and for this helpful forum!