我收到此错误:

Cannot initialize a parameter of type 'id<ZXingDelegate>'
with an lvalue of type 'FirstViewController *const __strong'

从以下代码行:
ZXingWidgetController *widController =
    [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES
                                                           OneDMode:NO];

我该如何解决?

最佳答案

感谢Macmade的评论,我设法解决了这个问题。我应该这样写:

ZXingWidgetController *widController =
    [[ZXingWidgetController alloc] initWithDelegate:***(id)** self showCancel:YES
                                                                     OneDMode:NO];

(id)是他所说的桥接 Actor 。

关于ios - 无法初始化参数,我不明白为什么,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8308427/

10-08 23:26