不兼容的指针类型将“类"发送到类型为"id< UIActionSheetDelegate>"的参数 [英] Incompatible pointer types sending 'Class' to parameter of type 'id<UIActionSheetDelegate>'

查看:88
本文介绍了不兼容的指针类型将“类"发送到类型为"id< UIActionSheetDelegate>"的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的"delegate:self"行中收到警告,指出类型"向"id"类型的参数发送不兼容的指针类型:

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;

此警告位于ShareKit中,如果有人知道如何解决它,请告诉我!

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

推荐答案

您正在尝试通过静态方法传递self参数.这是不对的,因为静态方法中没有此对象的特定实例.使它成为非静态方法,或将此类的某些实例作为委托传递.

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.

这篇关于不兼容的指针类型将“类"发送到类型为"id< UIActionSheetDelegate>"的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆