Giter Site home page Giter Site logo

Comments (6)

Wenzhi avatar Wenzhi commented on August 16, 2024

Hi @ldiqual,

Here is our orientation-related code for in-app message:

The default values for the supportedOrientations and supportedOrientationMasks are

_supportedOrientations = UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeRight |
        UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationPortraitUpsideDown;
_supportedOrientationMasks = UIInterfaceOrientationMaskAll;

In the in-app message's view controller:

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
  return self.supportedOrientations;
}
- (NSUInteger)supportedInterfaceOrientations {
  return self.supportedOrientationMasks;
}
- (BOOL)shouldAutorotate {
  return YES;
}

Please note that for the method supportedInterfaceOrientations, the return type should be UIInterfaceOrientationMask; we will update our code. But given that UIInterfaceOrientationMask is NSUInteger according to Apple's documentation, I don't think that is the reason for the crash.

Could you give us more information about how you use in-app message? Do you set the supportedOrientations and/or supportedOrientationMasks of ABKInAppMessageController? What are the steps to reproduce the crash?

Please let me know if you want any more information about code in Appboy.

Thanks,
Wenzhi

from appboy-ios-sdk.

ldiqual avatar ldiqual commented on August 16, 2024

@Wenzhi Thanks for the followup.

But given that UIInterfaceOrientationMask is NSUInteger according to Apple's documentation, I don't think that is the reason for the crash.

Agreed, that shouldn't matter here.

Could you give us more information about how you use in-app message? Do you set the supportedOrientations and/or supportedOrientationMasks of ABKInAppMessageController?

We don't do anything else other than integrating with segment with the Appboy integration enabled (using Segment-Appboy). We don't set supportedOrientations and co in ABKInAppMessageController. We do have a subclass of ABKFeedViewControllerModalContext (which also doesn't set supportedOrientations) but I believe it is unrelated.

What are the steps to reproduce the crash?

This is where it gets tough. We don't know for sure that it is due to Appboy inapp notifications, however:

  • The crash started appearing in a version where the only change was adding Appboy (via segment, and in a newsfeed tab)
  • Disabling inapp notifications on the server-side solved the issue for some of our users (after uninstalling the app, which I assume clears the inapp notification cache)
  • The only occurrence of preferredInterfaceOrientationForPresentation in our entire workspace is in ABKInAppMessageController.h
  • We reached out to one of our users and asked which orientation they were holding their phone when they started the app, it was landscape (while we support only portrait).

However there is no reference to Appboy in the stacktrace (which is not surprising, it's probably showing a view controller and that call is on the next runloop event). We also can't reproduce the crash (by sending inapp modals to our devices by holding our device in landscape mode).

Would you recommend setting the supported orientation modes manually? Also, why does your documentation indicate "In-app messages will normally support the orientations specified in the app settings" while it seems that they are hardcoded?

from appboy-ios-sdk.

Wenzhi avatar Wenzhi commented on August 16, 2024

Hi @ldiqual,

About Your Question

why does your documentation indicate "In-app messages will normally support the orientations specified in the app settings" while it seems that they are hardcoded?

Our in-app messages follow the app's orientation settings, even with the default values which support all orientations. Per Apple's supportedInterfaceOrientations documentation:

The system intersects the view controller's supported orientations with the app's supported orientations (as determined by the Info.plist file or the app delegate's application:supportedInterfaceOrientationsForWindow: method) to determine whether to rotate.

And In preferredInterfaceOrientationForPresentation:

When your view controller supports two or more orientations but the content appears best in one of those orientations, override this method and return the preferred orientation.

Regarding setting the orientation modes manually, it shouldn't make a difference in your case (IAMs will only ever show in portrait). That said, absent any other strong leads at this point, you might try setting that value.

About The Issue

Also - we display an in-app message with a UIWindow on top of the app's window and remove it after the in-app message is dismissed. Are you using any customized UIWIndow, too?

It's also possible this is a Swift-only issue. We'll investigate that avenue further.

Finally, if you have any information about the Devices/OSes that you're seeing this on, any info there would be useful.

Please let me know if you get more information about the crash, and/or if you have any follow-up comments/questions.

Thanks,
Wenzhi

from appboy-ios-sdk.

ldiqual avatar ldiqual commented on August 16, 2024

Hey @Wenzhi,

That said, absent any other strong leads at this point, you might try setting that value.

Will do this in our next version and report back.

Are you using any customized UIWIndow, too?

We're using a couple libraries that might use their own UIWindow to display content:

I'll take a look at their source code to see if there's something wrong there.

Finally, if you have any information about the Devices/OSes that you're seeing this on, any info there would be useful.

Our 3 affected users:

image
image
image

Full stacktrace:

image

Thanks for tackling this. I'll get back to you if we find more info on this.

from appboy-ios-sdk.

ldiqual avatar ldiqual commented on August 16, 2024

Doesn't seem to be happening in our new version. Closing for now.

from appboy-ios-sdk.

jinnamohamed1 avatar jinnamohamed1 commented on August 16, 2024

Hi

We have a crash on In-App messaging for large number of users related to preferredInterfaceOrientationForPresentation.

Fatal Exception: UIApplicationInvalidInterfaceOrientation
preferredInterfaceOrientationForPresentation '(7)' must match a supported interface orientation: 'portrait, landscapeLeft, landscapeRight, portraitUpsideDown'!
-[UIViewController _preferredInterfaceOrientationForPresentationInWindow:fromInterfaceOrientation:]

Our app supports only Portrait and mentioned in the info.plist as “UIInterfaceOrientationPortrait” under UISupportedInterfaceOrientations

I managed to reproduce the issue and explained below

  1. Received In-app message on our app
  2. Pressed home button without doing any action In-App
  3. Opened the app again, then it crashed.

When I debugged, I found that “preferredInterfaceOrientationForPresentation” function of “ABKInAppMessageWindowController” class returns unsupported interface orientation type on resuming the app from background

PS: We are using Appboy version 3.3.1

from appboy-ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.