Xcode warning when using the deprecated setStatusBarHidden method

I found this on StackOverflow regarding a problem, but could not solve my problem.

Calling the appropriate version of setStatusBarHidden for iOS

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

I set the OS deployment target level to 3.0, but still get the warning "setStatusBarHidden: animated: deprecated"

I would like to have no warnings, if possible in the project, and not to hack it. Is there a way I have to set up a project to remove this warning?

I installed the project SDK in 4.0. And the target base SDK is up to 4.0, the target SDK for deployment is up to 3.0.

I made these settings for "All configurations"

Thanks in advance

Update: Apparently, the warning appears only in the simulator, and not when installing for the device.

+3
3

, , . . , . setStatusBarHidden:withAnimation:

3.0, 3.2+, . , .

+4

, , , :

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

, iPhone Universal iPhone. , , 4.3, 3.0 .

+3

,

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
(void) methodUsingDeprecatedStuff { //use deprecated stuff }

, ,

#pragma GCC "-Wdeprecated-declarations"

.

, .

+1

Source: https://habr.com/ru/post/1754000/


All Articles