1

I want to resolve issue with statusBar in iOS7. I have found this post and this solution works great in Xcode 5. But when I tried this code in Xcode 4.6.3 I got 2 errors:

  1. No visible @interface for 'MyController' declares the selector 'setNeedsStatusBarAppearanceUpdate';
  2. Use of undeclared identifier 'UIStatusBarStyleLightContent'.

The first problem was solved by using this code: [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)]; but I can't resolve the second error.

Community
  • 1
  • 1
Valentin Shamardin
  • 3,371
  • 3
  • 30
  • 43
  • If you build against SDK6 and run on iOS7 you shouldn't have to do anything, so you could use respondsToSelector to see if setNeedsStatusBarAppearanceUpdate exists. Only if you build against SDK7 and run on iOS7, the status bar behavior will change. – Krumelur Aug 22 '13 at 09:04
  • @ValentinShamardin Wasn't me, but possibly because iOS 7 is still covered by an NDA. – Stephen Darlington Aug 22 '13 at 09:23
  • 2
    Yeah, there are a lot of NDA police around with nothing better to do than slap your wrists... !! , however you haven't disclosed anything that can't be found out by anyone with little effort. – bandejapaisa Aug 22 '13 at 10:35

1 Answers1

12

These are iOS 7 features that won't compile in XCode 4.6.3 which is trying to compile against iOS 6. You need to conditionally compile them out.

Wrap the offending code with:

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
    //iOS 7 only stuff here
#endif 
bandejapaisa
  • 24,838
  • 13
  • 86
  • 110