You can use conditional compiling to handle such cases:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 // iOS 7.0 supported
// iOS 7 code here
#else
// Pre-iOS 7 code here
#endif
When you compile under Xcode 5, you will be compiling against the iOS 7 SDK: in such case, the first branch is used. When you compile under Xcode 4.5, you will be using an older SDK version and the second branch will be used.
Notice the use of precompiler #if/#endif
: this will effectively make code visible or not visible to the compiler.
This will only fix the issue at compile time. But you still have another issue to consider: when your Xcode 5 built app will be run on an, e.g., iOS 6 device. In this case you app will crash, because of the use of the iOS 7-only feature. So you also need a runtime guard like:
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
In your case, this would give:
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 // iOS 7.0 supported
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0)
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
else
#endif
[UIApplication sharedApplication].statusBarStyle = ...;