Is ARC really supported in iOS 4? The iOS 4.2 SDK is missing ARC-related symbols at linking time

后端 未结 2 429
情歌与酒
情歌与酒 2020-11-28 06:36

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 t

2条回答
  •  醉梦人生
    2020-11-28 07:15

    A little bit late, but this is important information. The accepted answer is correct, Apple states iOS 4.0 and above as the minimum OS for ARC support.

    However, it can break in a few situations. One of them is of course the __weak keyword and it's derivatives. You will see an error like the following.

    dyld: lazy symbol binding failed: Symbol not found: _objc_initWeak
    

    A second and very dangerous condition is when you use the +load method of NSObject. If you do this using ARC on iOS 4.x you will have runtime crashes that are very hard to find. If you get runtime errors like the following, check your +load methods. For me it worked to set the -fno-objc-arc flag for that particular file.

    dyld: lazy symbol binding failed: Symbol not found: _objc_retainAutoreleasedReturnValue
    

提交回复
热议问题