我有一个对象,它包含对象的strong引用:
@property (nonatomic, strong) NSObject *thing;
Run Code Online (Sandbox Code Playgroud)
在其他地方,我有一个传递对象引用的方法:
[thirdObject doSomething:secondObject.thing];
Run Code Online (Sandbox Code Playgroud)
在一个案例中(百万或十亿),第三个对象最终使用悬空指针,因为对象被交换并且没有所有者.
这样做可以避免这种情况吗?这与ARC不同吗?
NSObject *thing = secondObject.thing
[thirdObject doSomething:secondObject.thing];
Run Code Online (Sandbox Code Playgroud)
如果没有,我该如何避免这种情况?
编辑:消息是"消息发送到解除分配的实例0xwhatever"