title: NSInteger,NSNumber "property 'x' with 'retain' attribute must be of object type "
body: <p>I am working an application in which data is being populated from an sqlite database. All database related stuff is done in the <code>appdelegate</code> class.  I have used <code>NSMutable</code> array to hold objects.
  I have used a separate <code>NSObject</code> class for properties.</p>
  
  <p>I am getting the error: <code>property 'x' with 'retain' attribute must be of object type</code>.</p>
  
  <p>My <code>appdelegate.m</code> file's code is as:</p>
  
  <pre><code>NSString *amovieName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];
  NSInteger amovieId = sqlite3_column_int(compiledStatement, 1);
  //problem is here the 
  //value of movieId is coming from database.
  //But error: "must be of object type" is puzzling me. 
  //I am assuming to use NSNumber here.
  </code></pre>
  
  <p>my NSObject file's code is as:</p>
  
  <p>in .h file-  </p>
  
  <pre><code>NSInteger movieId;
  </code></pre>
  
  <p>its property as:   </p>
  
  <pre><code>@property (nonatomic, retain) NSInteger movieId;
  </code></pre>
  
  <p>and in .m file-    </p>
  
  <pre><code>@synthesize movieId; 
  </code></pre>
  
  <p>then I have just initialize as:</p>
  
  <pre><code>-(id)initWithmovieName:(NSString *)mN movieId:(NSInteger)mId 
  {    
      self.movieName=mN;  
      self.movieId=mId;  
      return self;  
  }
  </code></pre>
  
  <p>I found another way as:
  assigning value in a NSnumber object .then type caste in NSInteger.for ex;</p>
  
  <pre><code>NSNumber aNSNumbermovieID = sqlite3_column_int(compiledStatement, 1); 
              NSInteger amovieId = [aNSNumbermovieID integerValue];
  </code></pre>
  
  <p>but still I am getting the same errors(property 'x' with 'retain' attribute must be of object type).</p>
  
  <p>Any suggestion?</p>