首页 > 解决方案 > 分配给 'void (^)(__strong id 的块指针类型不兼容)' 来自 'void (^)(TGClipboardGalleryPhotoItem *__strong)'

问题描述

我是ios开发新手。我的代码是

    [model.interfaceView updateSelectionInterface:selectionContext.count counterVisible:(selectionContext.count > 0) animated:false];
    model.interfaceView.donePressed = ^(TGClipboardGalleryPhotoItem *item)
    {
        __strong TGClipboardGalleryMixin *strongSelf = weakSelf;
        if (strongSelf == nil)
            return;
        
        strongSelf->_galleryModel.dismiss(true, false);
        
        if (strongSelf.completeWithItem != nil)
            strongSelf.completeWithItem(item);
    };

*行错误:model.interfaceView.donePressed = ^(TGClipboardGalleryPhotoItem item)

我收到以下错误:

*从 'void (^)(TGClipboardGalleryPhotoItem __strong)'分配给 'void (^)(__strong id)' 的不兼容块指针类型

我曾尝试将 typedef 添加到代码中,但它并没有解决我的问题。

标签: objective-c

解决方案


推荐阅读