Search code examples
iosobjective-cuistatusbar

App crashing with error +[UIStatusBar frameForStyle:orientation:]: unrecognized selector


I'm working on an app which was made in some older version of Xcode, it is currently having min supported version iOS 7.0

+[UIStatusBar frameForStyle:orientation:]: unrecognized selector sent to instance

I have set the break point, but unable to find the issue.


Solution

  • Guys thanks for your responses and interest, Accidentally I came to know that, I had set the UIStatusBar hidden, while there was a MPVloumeView added to view, Whenever I tried to change the volume, It crashed the application. According to another SO answer, the MPVloumeView should be in the first UIWindow of application.

    I just added another MPVloumeView in first window, and made it invisible

    MPVolumeView* mpView=[[MPVolumeView alloc]initWithFrame:CGRectMake(0, 0, 1, 1)];
    [mpView setTintColor:[UIColor clearColor]];
    mpView.alpha=0.01;
    {
        NSArray *windows = [UIApplication sharedApplication].windows;
        if (windows.count > 0) {
            [[windows objectAtIndex:0] addSubview:mpView];
        }
    }