将“Class”发送给types为“id <UIActionSheetDelegate>”的参数的指针types不兼容

我收到警告不兼容的指针types发送'类'参数types'id'在下面的行“委托:自我”:

+ (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,如果有人知道如何解决它,请让我知道!

你正试图通过静态方法传递自我参数。 这是不正确的,因为在静态方法中没有这个对象的特定实例。 使其成为非静态方法或将此类的某个实例作为委托来传递。

在使用静态类时,可以手动获取警告:

 delegate:(id<UIActionSheetDelegate>)self 

尝试使用nil而不是self(xcode 4.2 iOS 5)。

Interesting Posts