[英]Using weak references in a static library
I am trying to build a static library which support a deployment target iOS 4.3 and above. 我正在尝试构建一个静态库,该库支持部署目标iOS 4.3及更高版本。
The problem is that my code uses weak references. 问题是我的代码使用了弱引用。
Is it anyway possible to only build the library which uses weak references? 无论如何,只能构建使用弱引用的库吗?
There's this library from Plausible Labs that makes this work. 有来自Plausible Labs的这个库 ,可以完成这项工作。
PLWeakCompatibility
is a set of stubs that implement the Objective-C runtime functions the compiler uses to make__weak
work.PLWeakCompatibility
是一组存根,用于实现编译器用来使__weak
工作的Objective-C运行时功能。 It automatically calls through to the real runtime functions if they're present (ie your app is running on iOS5+ or Mac OS X 10.7+) and uses its own implementation if they're not.如果存在实时运行时功能(例如,您的应用程序在iOS5 +或Mac OS X 10.7+上运行),它将自动调用,如果不存在,则使用其自己的实现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.