title: Property '' not found on object of type 'id'
body: <p>I'm getting <strong><code>Property 'aVariable' not found on object of type id</code></strong> when trying to read or write aVariable to the array. Shouldn't it be known what class the object is that I added? Also noticed that it works to read the value with <code>NSLog(@" %@",[[anArray objectAtIndex:0] aVariable]);</code></p>
  
  <p>I'm a beginner at Objective C so it might be some simple thing I'm not getting.</p>
  
  <h2>AnObject</h2>
  
  <pre><code>@interface AnObject : NSObject
  
  @property (nonatomic,readwrite) int aVariable;
  
  @end
  </code></pre>
  
  <h2>AnotherObject</h2>
  
  <pre><code>@interface AnotherObject : NSObject
  
  @end
  </code></pre>
  
  <h2>test.h</h2>
  
  <pre><code>#import "test.h"
  
  @implementation AnObject
  @synthesize aVariable;
  
  - (id)init
  {
      self = [super init];
      if (self) {
          aVariable=0;
      }
      return self;
  }  
  
  @end
  </code></pre>
  
  <h2>test.m</h2>
  
  <pre><code>@implementation AnotherObject
  
  - (id)init
  {
      self = [super init];
      if (self) { }
      return self;
  }  
  
  - (NSMutableArray*) addToArray
  {
      NSMutableArray* anArray = [[NSMutableArray alloc] initWithCapacity:0];
      AnObject* tempObject = [[AnObject alloc] init];
  
      tempObject.aVariable=10;
      [anArray addObject:tempObject];
  
      // Property 'aVariable' not found on object of type 'id'
      [anArray objectAtIndex:0].aVariable=[anArray objectAtIndex:0].aVariable + 1; 
  
      // Property 'aVariable' not found on object of type 'id'
      NSLog(@" %i",[anArray objectAtIndex:0].aVariable); 
  
      // This works
      NSLog(@" %i",[[anArray objectAtIndex:0] aVariable]); 
  
      return anArray;
  }
  
  @end
  </code></pre>