I've read and heard since ARC was first announced that it was a compile-time thing and would be backwards-compatible with iOS 4. I have successfully refactored my project to ARC using Xcode 4.2's automatic refactoring, and when compiled against the iOS 5.0 SDK, it works fine. However, if I try to compile against my iOS 4.2 SDK, it fails at link time, missing the following symbols:
- _objc_retainAutoreleaseReturnValue
- _objc_autoreleaseReturnValue
- _objc_storeStrong
- _objc_retain
- _objc_release
- _objc_retainAutoreleasedReturnValue
I checked, and these symbols are present in 5.0 but not 4.2:
iPhoneOS5.0.sdk/usr/lib $ find . -type f|xargs nm|grep -i _objc_retain$
00005ed0 T _objc_retain
000061d0 T _objc_retain
iPhoneOS4.2.sdk/usr/lib $ find . -type f|xargs nm|grep -i _objc_retain$
[... *crickets* ...]
Does this mean that Apple lied? I assume instead that I'm confused and doing something wrong, but I can't figure out what.
This is with the GM release of Xcode 4.2 (Build 4C199)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…