Annoying warning caused in the normal creation of a delegate pattern in iOS. 

The standard approach of using

dot.delegate = self;

in the parent, generated the warning message:

Assigning to ‘id<ZoneDotDelegate>’ from incompatible type ‘ViewController *const __strong’.

This delegate had been @property (assigned) id <ZoneDotDelegate> delegate; in the .h file.

I tried lots of things including changing the @property definition, to no avail. Then I stumbled onto resolving the warning with this solution:

dot.delegate = (id <ZoneDotDelegate>)self;
which, I think, is described as a ‘casting’ of the ViewController instance as the delegate.

This post has already been read 0 times!