How do you weak link frameworks when developing for the iPhone?
Once you've weak-linked a framework, how do you use classes and methods that may not be present 开发者_如何学Pythonon all OS versions?
What do you want to use weak Linking for?
A common use is to use a class defined only in a newer version of the SDK. The framework exists on older systems, but a class defined in the framework doesn't.
If this is the case then use NSClassFromString(). If it returns nil, the class doesn't exist, otherwise it will return the class object which can be used.
This is the recommended way according to Apple in this document:
精彩评论