title: EXC_BAD_ACCESS when synthesizing a 'global' object
body: <p>this is a follow-up question to my last one here: <a href="https://stackoverflow.com/questions/9427101/ios-initialise-object-at-start-of-application-for-all-controllers-to-use/9427498#comment11941293_9427498">iOS: Initialise object at start of application for all controllers to use</a> .</p>
  
  <p>I have set my application up as follows (ignore the DB Prefix):</p>
  
  <pre><code>DBFactoryClass     // Built a DataManaging Object for later use in the app
  DBDataModel        // Is created by the factory, holds all data &amp; access methods
  DBViewControllerA  // Will show some of the data that DBDataModel holds
  moreViewControllers that will need access to the same DBDataModel Object
  </code></pre>
  
  <p>i will go step by step through the application, and will then in the end post the error message i get when building.</p>
  
  <p>AppDelegate.h</p>
  
  <pre><code>#import "DBFactoryClass.h"
  </code></pre>
  
  <p>AppDelegate.m</p>
  
  <pre><code>- (BOOL)...didFinishLaunching...
  {
      DBFactoryClass *FACTORY = [[DBFactoryClass alloc ]init ];
      return YES;
  }
  </code></pre>
  
  <p>DBFactoryClass.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  #import "DBDataModel.h"
  
  @interface DBFactoryClass : NSObject
  @property (strong) DBDataModel *DATAMODEL;
  @end
  </code></pre>
  
  <p>DBFactoryClass.m</p>
  
  <pre><code>#import "DBFactoryClass.h"
  
  @implementation DBFactoryClass
  @synthesize DATAMODEL;
  
  -(id)init{
      self = [super init];
      [self setDATAMODEL:[[DBDataModel alloc]init ]];
      return self;
  }
  
  @end
  </code></pre>
  
  <p>ViewControllerA.h</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "DBDataModel.h"
  
  @class DBDataModel;
  @interface todayViewController : UIViewController
  @property (strong)DBDataModel *DATAMODEL;
  @property (weak, nonatomic) IBOutlet UILabel *testLabel;
  @end
  </code></pre>
  
  <p>ViewControllerA.m</p>
  
  <pre><code>#import "todayViewController.h"
  
  @implementation todayViewController 
  @synthesize testLabel;
  @synthesize DATAMODEL;
  
  - (void)viewDidLoad
  {
      todaySpentLabel.text = [[DATAMODEL test]stringValue];
  }
  @end
  </code></pre>
  
  <p>DBDataModel.h</p>
  
  <pre><code>#import &lt;Foundation/Foundation.h&gt;
  
  @interface DBDataModel : NSObject
  @property (nonatomic, retain) NSNumber* test;
  @end
  </code></pre>
  
  <p>DBDataModel.m</p>
  
  <pre><code>#import "DBDataModel.h"
  
  @implementation DBDataModel
  @synthesize test;
  -(id)init{
      test = [[NSNumber alloc]initWithInt:4];
      return self;
  }
  @end
  </code></pre>
  
  <p>when i build it, i get the following error: <code>EXC_BAD_ACCESS</code> in this line:</p>
  
  <pre><code>@synthesize DATAMODEL;
  </code></pre>
  
  <p>of <code>DBFactoryClass.m</code> </p>