How can I perform a run-time check to see if I can use UIGraphicsBeginImageContextWithOptions, which is only available starting with iOS 4.
I know I could check [[UIDevice currentDevice] systemVersion], but Apple recommends using things like NSClassFromString() or respondsToSelector:. Is there a respondsToSelector: for C functions?
Here’s another option, which I’ve been using.
C functions are pointers. If you “weak” link to
UIKitframework, on iOS 3 the function pointer will simply beNULL, so you can test for the existence of the function by doing:See also: How do I weak link frameworks on Xcode 4?