views:

94

answers:

1

What does it mean to have a weak reference to a framework in iphone sdk?

+1  A: 

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.

There might also be some performance differences in start up time causing apps with weak references to launch much slower.

hotpaw2
Do you have a reference for benchmarks on the startup time being slower due to weak linking? I specifically asked Apple engineers about this at WWDC and they knew of no such slowdown. I have not observed it in my own applications.
Brad Larson
The slow down may be old information then.
hotpaw2
First of all, thanks for the answer... and I didn't notice the performance differences in start up either.
Omer