【发布时间】:2017-03-08 18:48:59
【问题描述】:
最近我是 ARC 机制的新手,我在下面提供的函数指针中发现了一个问题,该问题在非 ARC 中可以正常工作,但在 ARC 中不能正常工作
Please find the following piece of code
Class cls = objc_getAssociatedObject(object, originalClassVar);
ObjCPropertyInfo *propInfo = objc_getAssociatedObject(cls, selector);
struct objc_super objectSuper;
objectSuper.receiver = object;
objectSuper.super_class = cls;
id (*fPtrSuper)(struct objc_super*,SEL,float) = (id (*)(struct objc_super*,SEL,float))objc_msgSendSuper;
fPtrSuper(&objectSuper, selector, newVal);
如果我用 void 替换 Id 可以正常工作,请提供 cmets
【问题讨论】:
-
“不工作”是什么意思?但是,函数指针不受 ARC(或 MRR)的约束。
-
那不是真正的代码。请显示真实代码。
-
HI Amin 和 matt 更新了代码,请检查。
标签: ios objective-c automatic-ref-counting