SimplyKiwi
SimplyKiwi

Reputation: 12444

Incompatible pointer types sending 'Class' to parameter of type 'id<UIActionSheetDelegate>'

I am receiving the warning Incompatible pointer types sending 'Class' to parameter of type 'id' in the line "delegate:self" below:

    + (SHKActionSheet *)actionSheetForType:(SHKShareType)type
{
    SHKActionSheet *as = [[SHKActionSheet alloc] initWithTitle:SHKLocalizedString(@"Share")
                                                      delegate:self
                                             cancelButtonTitle:nil
                                        destructiveButtonTitle:nil
                                             otherButtonTitles:nil];
    as.item = [[[SHKItem alloc] init] autorelease];
    as.item.shareType = type;

This warning is in ShareKit, if anyone knows how to fix it, please let me know!

Upvotes: 13

Views: 21481

Answers (3)

Cœur
Cœur

Reputation: 38667

When working with a static Class, you can manually get ride of the warning:

delegate:(id<UIActionSheetDelegate>)self

Upvotes: 9

Sonny Parlin
Sonny Parlin

Reputation: 931

Try using nil instead of self (xcode 4.2 iOS 5).

Upvotes: 3

Nikita Leonov
Nikita Leonov

Reputation: 5694

You are trying to pass self parameter in a static method. It is not right as there is no particular instance of this object in static methods. Make it either non static method or pass some instance of this class as delegate.

Upvotes: 21

Related Questions