robovm / robovm-robopods

63 stars 86 forks source link

HeyZap crashes while clicking interstitials (landscape-only game) #62

Open ghost opened 8 years ago

ghost commented 8 years ago

Last Exception Backtrace: 0x2466d85b exceptionPreprocess + 127 0x35af2dff objc_exception_throw + 38 0x2466d7a1 +[NSException raise:format:] + 112 0x288192e1 -[UIViewController supportedInterfaceOrientations] + 844 0x28818d15 -[UIViewController _preferredInterfaceOrientationGivenStatusBarAndDeviceAndOrientation:] + 92 0x2889da35 -[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:] + 656 0x2900c8c7 -[_UIFullscreenPresentationController _adjustOrientationIfNecessaryInWindow:forViewController:preservingViewController:] + 442 0x28ae75ff -[UIPresentationController _presentWithAnimationController:interactionController:target:didEndSelector:] + 1018 0x28b085c5 -[UIViewController _presentViewController:modalSourceViewController:presentationController:animationController:interactionController:completion:] + 1312 0x28b09e55 -[UIViewController _presentViewController:withAnimationController:completion:] + 4348 0x28b0c1e5 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 336 0x28b0c451 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 416 0x2889a367 -[UIViewController presentViewController:animated:completion:] + 142 0x007fe09d __125-[HZStorePresenter presentAppStoreForID:presentingViewController:delegate:useModalAppStore:clickURL:impressionID:completion:]_block_invoke (HZStorePresenter.m:106)

I'm using the latest SNAPSHOT, this happens with all mediated networks (rewarded videos) as far as I can tell. In my info.plist.xml I have UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight, the crash disappears if I add both portrait orientations (and the game rotates correctly to landscape thanks to the LibGDX config), but this is not a solution since the initial heavy flickering/rotation with the launch image on iPad would cause app rejection.

kismosis commented 8 years ago

found similar issue with a heyzap network interstitial click which caused:

IOSLauncher[10405] : *\ Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [SKStoreProductViewController shouldAutorotate] is returning YES'

again without info plist portrait. chartboost was showing interstitial in wrong orientation which is why i disabled portrait from info plist.

noted that the heyzap portrait interstitial click tries to take you directly to the App Store in portrait mode without leaving your app. hence no portrait and crash.

BlueRiverInteractive commented 8 years ago

This is most likely a configuration issue or a bug in HeyZap. I will update the SDK to the latest beta version, that may help. You could also check the following: ) Make sure the root view controller of your app is set before you request/display any ads. ) Add the following to your UIApplicationDelegate:

@Override
    public UIInterfaceOrientationMask getSupportedInterfaceOrientations(UIApplication application, UIWindow window) {
        return UIInterfaceOrientationMask.All;
    }

*) Maybe the issue is related to libGDX using a GLKViewController and you need to use a different view controller for HeyZap. Please try to use the debug view controller (HeyzapAds.presentMediationDebugViewController();) and check if everything works there. Or create a new iOS project, change the supported orientations in Info.plist.xml and add the Heyzap code.

fkrstevski commented 8 years ago

I had this issue as well, my game is in landscape orientation, but when you click the interstitial it opens the play store which is in portrait mode and it crashes since that orientation is not supported. I fixed this by modifying the config application like so:

IOSApplicationConfiguration config = new IOSApplicationConfiguration();
config.orientationLandscape = true;
config.orientationPortrait = false; 

and adding portrait orientation to my plist file:

<key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationPortrait</string>
    </array>

hope this helps

ekilah commented 8 years ago

Hi all, I'm an engineer at Heyzap, and we found your thread after receiving a report about this same type of crash.

I just wanted to drop in and tell you a couple things that might help debug this issue:

Just to confirm, we've tried to repro the issue, and can't reproduce this ourselves in a native iOS application that's landscape-only. This and the comment from @fkrstevski lead me to believe the issue is probably in the RoboVM orientation configuration somewhere.

If I were to just guess at the issue, it sounds like the iOS SKStoreProductViewController sees (from the iOS build configuration, the .plist or something - I'm not exactly sure what the internals of the library does) that the application supports portrait when it doesn't due to how RoboVM handles orientation locking. I've never used RoboVM myself though so it's hard to say.

Again, just guessing, I bet that Apple prefers to show this view in portrait over landscape, so if it thinks it can show it in portrait it will do so over landscape.

Has anyone tried @fkrstevski 's suggestion to see if it works for them?

obigu commented 8 years ago

Nice to see a HeyZap engineer helping libGDX/RoboVM users :).

Yes, @fkrstevski suggestion works. I also needed to do this originally on my libGDX landscape-only games some time ago because there was an external view that was portrait (can't remember whether it was the AppStore, Game Center or a native Facebook one) and it crashed the app. I'm also using HeyZap integration with no issues . Don't know how pure RoboVM (non-libGDX) apps would need to handle it or if it's libGDX specific.

Regarding orientation you can set the 4 of them if you prefer as long as you define the libGDX IOSApplication to landscape only.

 <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationPortraitUpsideDown</string>
    </array>