Tutorial :iPhone, check for existence of constant



Question:

How can you check if a constant is set at runtime? For instance, in iOS 4, UIApplicationDidEnterBackgroundNotification is available, but when running on iOS 3 it will through an error if you try to use it.


Solution:1

You should probably look at this other question, which in my opinion also answers yours. if (&UIApplicationWillEnterForegroundNotification != NULL) should be dynamic-linking-safe and tell you whether the constant exists or not.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »