I created a variable called myDBManager in an AppDelegate application:
@interface myAppDelegate : NSObject <UIApplicationDelegate> {
MyDBManager *myDBManager;
}
@property (nonatomic, retain) MyDBManager *myDBManager;
@end
which I use in most other classes as a global variable containing all of my critical application data. It is created only once and dies only at the end. So for example, to get to myDBManager in AnyOtherClass
@interface AnyOtherClass : UITableViewController {
MyDBManager *myDBManager;
NSObject *otherVar;
}
@property (nonatomic,retain) MyDBManager *myDBManager;
@property (nonatomic,retain) NSObject *otherVar;
@end
- (void)viewWillAppear:(BOOL)animated {
MyAppDelegate *mainDelegate = (MyAppDelegate *)[[UIApplication sharedApplication]delegate];
myDBManager = mainDelegate.myDBManager;
}
- (void)dealloc {
[otherVar release];
[super dealloc];
}
Here is my question: while all other AnyOtherClass local variables, such as "otherVar", must be issued in the dealloc AnyOtherClass method (is it always right?), Releasing myDBManager in AnyOtherClass leads to application errors,
, myDBManager - - . ( saveCount).
, dealloc , , , ? ( ?)
!