nicklockwood/iVersion

Setting the delegate in the AppDelegate generates a warning.

sgabello opened this issue · 2 comments

Hi Nick,
I found that when you set the delegate like:

[iVersion sharedInstance].delegate = self;

You get a warning saying:
warning: Semantic Issue: Incompatible pointer types assigning to 'id' from 'Class'

Changing the line to

[iVersion sharedInstance].delegate = (id)self;

gets rid of the warning... but I think there's something wrong anyway... it shouldn't be necessary.
I don't understand why self returns a type of Class instead of NSObject.

This happens also in the iPhone example project which comes with iVersion.

Cheers,
Andrea

You're probably setting the delegate from within the

+(void)initialize

method, which is a class method, so "self" refers to the class. You'll need to set the iVersion delegate from within the

-(void)application:didFinishLaunchingWithOptions:

method instead, which is an instance method, so the "self" refers to the instance.

Sorry, the documentation isn't very clear on that point.

I see! Thanks for the explanation: I didn't know that self inside a class is the class and I would have never figured it out by myself! But now that you told me that, it makes perfect sense!!! Thanks!