What does it mean to have a weak reference to a framework in iphone sdk?
对于iphone sdk中框架的弱引用意味着什么?
1 个解决方案
#1
6
In practice, if you build an app with a required reference to a framework, rather than a weak reference, and try to run that app on a device which doesn't include that framework, the app with crash, even if you don't try to use that framework.
在实践中,如果你构建一个应用程序,需要参考一个框架,而不是一个弱引用,并尝试在一个不包含该框架的设备上运行该应用程序,即使你不尝试使用该框架,它也会崩溃。
If, however, you build an app with a weak reference to a framework, and run it on a device that does not support that framework, and do not access classes (methods, subroutines, etc.) in that framework (because you, say, run-time tested for the existence of that framework beforehand) then your app will not simply crash on startup. But since the framework is weakly linked, you could call that framework from that same app on a device which supported that framework. Thus your app might support different OS versions with and without support for a given framework.
然而,如果你与一个弱引用建立一个应用程序框架,并在设备上运行它,不支持框架,并且不访问类(方法、子程序等)的框架(因为你,说,运行时存在的测试框架之前)那么你的应用程序在启动时不会只是崩溃。但是由于框架是弱链接的,所以您可以在支持该框架的设备上从同一应用程序调用该框架。因此,您的应用程序可能支持不同的OS版本,并且不支持给定的框架。
There might also be some performance differences in start up time causing apps with weak references to launch much slower.
在启动时可能会出现一些性能差异,导致应用程序弱引用的应用程序要慢得多。
#1
6
In practice, if you build an app with a required reference to a framework, rather than a weak reference, and try to run that app on a device which doesn't include that framework, the app with crash, even if you don't try to use that framework.
在实践中,如果你构建一个应用程序,需要参考一个框架,而不是一个弱引用,并尝试在一个不包含该框架的设备上运行该应用程序,即使你不尝试使用该框架,它也会崩溃。
If, however, you build an app with a weak reference to a framework, and run it on a device that does not support that framework, and do not access classes (methods, subroutines, etc.) in that framework (because you, say, run-time tested for the existence of that framework beforehand) then your app will not simply crash on startup. But since the framework is weakly linked, you could call that framework from that same app on a device which supported that framework. Thus your app might support different OS versions with and without support for a given framework.
然而,如果你与一个弱引用建立一个应用程序框架,并在设备上运行它,不支持框架,并且不访问类(方法、子程序等)的框架(因为你,说,运行时存在的测试框架之前)那么你的应用程序在启动时不会只是崩溃。但是由于框架是弱链接的,所以您可以在支持该框架的设备上从同一应用程序调用该框架。因此,您的应用程序可能支持不同的OS版本,并且不支持给定的框架。
There might also be some performance differences in start up time causing apps with weak references to launch much slower.
在启动时可能会出现一些性能差异,导致应用程序弱引用的应用程序要慢得多。