如何修复下面第3行中的编译器错误'receiver' is unavailable: this system field has retaining ownership
?
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:));
}
答案 0 :(得分:2)
使用ARC,C-Structs无法存储指向Objective-C对象的指针。
你有没有尝试过像这样的桥接演员?
super.receiver = (__bridge void*)self;
答案 1 :(得分:0)
使用objective-c ++而不是objective-c(.mm文件)。