views:

467

answers:

1

I found this on StackOverflow regarding the problem, but was not able to solve my problem.

http://stackoverflow.com/questions/3028255/about-setstatusbarhidden

if([[UIApplication sharedApplication] respondsToSelector:@selector(setStatusBarHidden: withAnimation:)])
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:NO];
else 
    [[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

I set my OS deployment target to 3.0, yet I still recieve the warning 'setStatusBarHidden:animated: is deprecated'

I'd like to have no warnings if possible in the project, and not a hack that removes it. Is there a way I'm supposed to set up the project to remove this warning?

I've set the project base SDK to 4.0. And the target Base SDK to 4.0, deployment target SDK to 3.0.

I made these settings for 'All configurations'

Thanks in advance

Update: Apparently the warning only appears in the simulator, not when set for Device.

+1  A: 

A deprecation warning means that you are using something that will not be supported in the future. This particular syntax is listed as deprecated here. You get rid of the warning by not using the deprecated method. You should be using setStatusBarHidden:withAnimation: instead

If you wish to support this functionality on both 3.0 and 3.2+ then you will have to write conditional code based upon the target version. There is some useful information on pre-processor macros and functions to help you here.

Steve Weet
But that doesn't work with OS 3.0 devices. It crashes my iPod touch with OS 3.1.3 for unrecognized selector.
just_another_coder
I'm not an Iphone developer but I think you have to check if a particular feature from a later version exists before using it by calling respondsToSelector (From your link above)
Steve Weet
Harsh down-vote BTW. The answer was correct as it stood. Anyhow edited with some more info.
Steve Weet
just_another_coder
Updated above, apparently this only affect the simulator, not when set for device. Strange.
just_another_coder