简体   繁体   中英

Could i build a ARC framework and use it in a non-ARC project?

我认为标题很好地解释了我的问题,我目前正在研究一个小框架以满足我的个人需求,并考虑用ARC构建它(如果可能的话)?并在以前构建的旧项目中使用它弧?

Yes, with one caveat: if you have iOS 4.x as a deployment target, a supplemental library is necessary to deal with ARC-compiled code on the older runtime. For an application built using ARC, this is packaged in with the application. This is not included if you are using an ARC-compiled library in a non-ARC application.

You can manually link this library into your non-ARC application to avoid runtime problems on the older OS versions by adding -fobjc-arc to your Other Linker Flags for the application.

See this Apple Developer Forums thread for some more discussion on this.

You can link against the glue library provided by Apple (as Brad has said in his answer above). However, the __weak variable qualifier is not compatible with operating systems below 4.3 (As mentioned here: iOS 5 Best Practice (Release/retain?) in a comment by sudo).

Should be fine. The library is already compiled, so ARC/NonARC shouldn't matter anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM