You cannot use macros for this. Macros are evaluated at compile time, rather than at run time, for what you want to discover features / capabilities, such as iCloud support. (Otherwise, you will eventually turn it on, as you are compiling the iOS 5 SDK in all cases)
You should simply check for ubiquity methods that tell you if you can call them, which tells you if iCloud is supported, for example:
if ([[NSFileManager defaultManager] respondsToSelector:@selector(isUbiquitousItemAtURL:)]) { // call it and do other iCloud stuff }
Quick followup note re: your compilation question. Compilation is a process that turns your actual code into a binary file that runs on the device. This happens when you build in Xcode, and it only happens on your computer, never on Apple or on the device. That's why compilation time checks of versions will not work - by the time you send them to the device, the decision has already been made.
source share