开发者

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

开发者 https://www.devze.com 2023-03-26 15:31 出处:网络
I am receiving the warning Incompatible pointer types sending \'Class\' to parameter of type \'id\' in the line \"delegate:self\" below:

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
                                        d开发者_StackOverflow中文版estructiveButtonTitle: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!


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.


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

delegate:(id<UIActionSheetDelegate>)self


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号