Statusbar background was nil,after presenting the SKStoreProductViewController in ios 8.4

341 views Asked by At

I'm using SKStoreProductViewController for opening the appstore in my app. it was presenting successfully,but the statusbar in it was not showing, Navbar looks like a 44pixels height. But it won't happens in any iOS 8.3v in any device. This situation happens only in all iOS 8.4v devices.

In my plist UIViewControllerBasedStatusbarAppearance is set to NO. i tried with Yes also, but no use.

enter image description here

the Red color in status bar is superview navigationbar color.

NOTE: i'm presenting the SKStoreProductViewController from my ParentViewController.

Any help will be greatly appreciated.

1

There are 1 answers

1
Brajmohan Papneja On

I solved this by adding statusBar as UIView Component, Its a workaround to the solution. I also faced similar issue.

   SKStoreProductViewController *_apsvc = [[SKStoreProductViewController alloc]init];
    _apsvc.delegate = self;

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) {
        UIView *addStatusBar = [[UIView alloc] init];

        //change this to match your navigation bar

        UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController;

        addStatusBar.frame = CGRectMake(0, 0, viewController.view.frame.size.width, 20);

        addStatusBar.backgroundColor =[UIColor whiteColor];


    }


    UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController;
    if (viewController)
    {
        [[UIApplication sharedApplication].keyWindow.rootViewController  presentViewController:_apsvc animated:YES completion:^()
         {

             [_apsvc loadProductWithParameters:@{SKStoreProductParameterITunesItemIdentifier : AppID}
                  completionBlock:^(BOOL result, NSError *error) {
                      if(error)
                      {
                         ....
                      }
                  }];
              [viewController.view addSubview:addStatusBar];

         }];

    }

}


    -(void)productViewControllerDidFinish:(SKStoreProductViewController    *)viewController
   {
        [addStatusBar removeFromSuperview];
       if (viewController)
       { 
       [viewController dismissViewControllerAnimated:YES completion:nil];
       }
    }