Reputation: 3184
Is there a common way to detect if a symbol exists or not? Like CGPathCreateCopyByStrokingPath()
in iOS5, which is only available on iOS5 and later.
If I compile and run apps using this routine on iOS 4 devices, I would get a runtime dyld error.
In Objective-C, +class and other utility APIs can be used to determine the existence of some class or some selector, is there any API to do this on dyld-ed symbols?
Or is it under Apple's permission to use dyld functions for an AppStore oriented app?
Upvotes: 0
Views: 689
Reputation: 4185
To check the availability of a function, explicitly compare its address to NULL or nil.
if (CGPathCreateCopyByStrokingPath != NULL) {
// it exists
}
Here's Apple's documentation on the matter (listing 3-2).
Upvotes: 4