The image that iOS shows when the app goes into the background is displayed upside down when viewed in portrait mode

I am creating an iOS app that is terrain only. When my app goes to background image, the image displayed by iOS in the multitasking apps list got confused. It displays a landscape image upside down in portrait mode.

I am not doing anything specific in applicationWillResignActive

and applicationWillEnterForeground

.

Here is an image showing the problem.

Screenshot showing the list of apps running currently

I only allowed landscape mode for my application by setting them in General and Info.plist files as shown below:

App's General properties showing Device Orientation locked to Landscape only

Info.plist file:

Info.plist file showing the supported orientations for the app

Of course, it looks like one of the third party ad libraries is causing a mess. The problem does not occur with the free version of this app. Is there anything I can do to prevent third party libraries from causing this mess?

So, I'm using iAd and AdMob along with adapters to support mediation (to support InMobi, MobFox and Millennial Media).

Is there anything I can do to fix this?

+3


source to share


2 answers


A workaround is to remove the ad from the supervisor in applicationWillResignActive

and re-add it to applicationDidBecomeActive

(preferably using NSNotifications).

Thus, the deletion will look something like this:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    [self.adBanner removeFromSuperview];
}

      



And adding it:

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
    [self.view addSubview:self.adBanner];
    [self.view addConstraints:@[self.adXConstraint, self.adYConstraint]];
}

      

+1


source


This is new. The only way to know where you can affect the multitasking snapshot is with background fetch, where you call the completion handler provided to you in the background fetch callback.

I quickly checked one of my apps by locking it in landscape mode and it didn't. How do you close the app to terrain? Are you using the General tab in your target project settings? There's a section where you can adjust the orientation of your app.



In my opinion, a hack in your orientation lock code could lead to this behavior.

0


source







All Articles