Make an iPhone specific app work on iPad to meet Apple requirements

后端 未结 6 695
梦谈多话
梦谈多话 2020-12-06 02:24

My app has been in the AppStore for a couple of months now and always only worked on iPhone. I recently submitted an update which was rejected because the App does not run o

6条回答
  •  我在风中等你
    2020-12-06 02:34

    I'll try to explain what my problem and solution was..

    I have an iPhone only app which is mostly in portrait, however, because of 1 or 2 UIViewControllers which have to be in all UIInterfaceOrientations, I have to enable all UIInterfaceOrientations in my plist.

    When starting the app on an iPad which is rotated in landscape and is lying on the table (so has UIDeviceOrientationFaceUp), the whole app was shown in landscape, which made my UI totally messed up.

    I had no reference to any iPad related code / settings in my plist or launch screens whatsoever (I am using .xcassets for launch screens).

    I fixed it by adding 1 line of code to my AppDelegate.m which sets the statusbar orientation to force the app in portrait mode.

    -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated:NO];
    
        //Further setup
    }
    

提交回复
热议问题