Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 790
SimplyKiwi Avatar asked Aug 09 '11 02:08

SimplyKiwi


3 Answers

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

delegate:(id<UIActionSheetDelegate>)self
like image 79
Cœur Avatar answered Nov 03 '22 16:11

Cœur


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.

like image 43
Nikita Leonov Avatar answered Nov 03 '22 14:11

Nikita Leonov


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

like image 3
Sonny Parlin Avatar answered Nov 03 '22 15:11

Sonny Parlin