查看clang源代碼,將對象存儲到__strong變量中。
https://github.com/llvm-mirror/clang/blob/master/lib/CodeGen/CGObjC.cpp#L2108-L2119
// Retain the new value.
newValue = EmitARCRetain(type, newValue);
// Read the old value.
llvm::Value *oldValue = EmitLoadOfScalar(dst, SourceLocation());
// Store. We do this before the release so that any deallocs won't
// see the old value.
EmitStoreOfScalar(newValue, dst);
// Finally, release the old value.
EmitARCRelease(oldValue, dst.isARCPreciseLifetime());
所以,你的代碼將被編譯成以下。
id newValue = [[AVDelegatingPlayer alloc] initWithURL:[NSURL URLWithString:urlString]];
id oldValue = self.player;
self.player = newValue;
[oldValue release];
不,這是由ARC自動處理的。 – 2014-09-24 19:29:22