如何修复下面第 3 行中的编译器错误“接收器”不可用:此系统字段保留所有权
?
UIKIT_STATIC_INLINE void sample_drawRect(id self, SEL _cmd, CGRect rect) {
struct objc_super super;
super.receiver = self;
super.super_class = class_getSuperclass([self class]);
objc_msgSendSuper(&super, @selector(drawRect:));
}
最佳答案
使用 ARC,C-Structs 无法存储指向 Objective-C 对象的指针。
你尝试过像这样的桥接 Actor 吗?
super.receiver = (__bridge void*)self;
关于objective-c - 为什么 objc_super.receiver 在 ARC 中不可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9331119/