title: Why do I need to cast self to id?
body: <p>I have an init method that takes an (id) argument:</p>
  
  <pre><code>
      -(id) initWithObject:(id) obj;
  </code></pre>
  
  <p>I'm trying to call it like this:</p>
  
  <pre><code>
      [[MyClass alloc] initWithObject:self];
  </code></pre>
  
  <p>But XCode is complaining about the argument being a "distinct Objective-C type" (which usually indicates a type mismatch or level of indirection error).</p>
  
  <p>If I explicitly cast self to (id) the warning goes away. In either case the code runs as expected.
  Interestingly, on the next line I'm passing self to another method that also takes an id, and that works fine.</p>
  
  <p>I'm wondering if I'm missing something subtle - or is it a peculiarity of the compiler?</p>
  
  <p>I'm not entirely comfortable just casting it until I'm sure of the reasons why it's necessary.</p>
  
  <p>[Edit]</p>
  
  <p>I've been asked to supply more code. Not sure there's much else that's relevant. Here's my actual code that makes the call. Note that it is, itself, within an init method. It's the call to <code>initWithSource</code> that's giving the warning:</p>
  
  <pre><code>
  -(id) initWithFrame:(CGRect) frame
  {
      self = [super initWithFrame: frame];
      if( self )
      {
          delegate = nil;
          touchDelegate = [[TBCTouchDelegate alloc] initWithSource:self];
          [touchDelegate.viewWasTappedEvent addTarget: self action:@selector(viewWasTapped:)];
      }
      return self;
  }
  </code></pre>
  
  <p>And here's the init method being called:</p>
  
  <pre><code>
  -(id) initWithSource:(id) sourceObject
  {
      self = [super init];
      if (self != nil) 
      {
          // Uninteresting initialisation snipped
      }
      return self;
  }
  </code></pre>