{"action":"created","issue":{"url":"https://api.github.com/repos/Appboy/appboy-ios-sdk/issues/54","repository_url":"https://api.github.com/repos/Appboy/appboy-ios-sdk","labels_url":"https://api.github.com/repos/Appboy/appboy-ios-sdk/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/Appboy/appboy-ios-sdk/issues/54/comments","events_url":"https://api.github.com/repos/Appboy/appboy-ios-sdk/issues/54/events","html_url":"https://github.com/Appboy/appboy-ios-sdk/issues/54","id":142006349,"number":54,"title":"preferredInterfaceOrientationForPresentation crash when displaying in app notification","user":{"login":"ldiqual","id":941453,"avatar_url":"https://avatars.githubusercontent.com/u/941453?v=3","gravatar_id":"","url":"https://api.github.com/users/ldiqual","html_url":"https://github.com/ldiqual","followers_url":"https://api.github.com/users/ldiqual/followers","following_url":"https://api.github.com/users/ldiqual/following{/other_user}","gists_url":"https://api.github.com/users/ldiqual/gists{/gist_id}","starred_url":"https://api.github.com/users/ldiqual/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ldiqual/subscriptions","organizations_url":"https://api.github.com/users/ldiqual/orgs","repos_url":"https://api.github.com/users/ldiqual/repos","events_url":"https://api.github.com/users/ldiqual/events{/privacy}","received_events_url":"https://api.github.com/users/ldiqual/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-19T00:15:15Z","updated_at":"2016-03-19T04:11:33Z","closed_at":null,"body":"We're noticing crashes when displaying inapp notifications:\r\n\r\n```\r\nFatal Exception: UIApplicationInvalidInterfaceOrientation\r\npreferredInterfaceOrientationForPresentation must return a supported interface orientation!\r\n```\r\n\r\n![image](https://cloud.githubusercontent.com/assets/941453/13895073/3aac9960-ed2c-11e5-93d4-87e7f80d345a.png)\r\n\r\nWe only support portrait orientation.\r\nA quick search in our workspace found this: https://github.com/Appboy/appboy-ios-sdk/blob/master/AppboyKit/headers/AppboyKitLibrary/ABKInAppMessageController.h#L31-L40\r\n\r\nIt's unclear from the documentation whether orientations are automatically detected\r\n\r\n > In-app messages will normally support the orientations specified in the app settings\r\n\r\nor if all of them are returned by default\r\n\r\n > The default value of supportedOrientations includes all orientations\r\n\r\nWould you mind clarifying the actual behavior and/or sharing the underlying code?\r\n\r\nSide note: this is why https://github.com/Appboy/appboy-ios-sdk/issues/44 is important to us."},"comment":{"url":"https://api.github.com/repos/Appboy/appboy-ios-sdk/issues/comments/198630536","html_url":"https://github.com/Appboy/appboy-ios-sdk/issues/54#issuecomment-198630536","issue_url":"https://api.github.com/repos/Appboy/appboy-ios-sdk/issues/54","id":198630536,"user":{"login":"Wenzhi","id":996652,"avatar_url":"https://avatars.githubusercontent.com/u/996652?v=3","gravatar_id":"","url":"https://api.github.com/users/Wenzhi","html_url":"https://github.com/Wenzhi","followers_url":"https://api.github.com/users/Wenzhi/followers","following_url":"https://api.github.com/users/Wenzhi/following{/other_user}","gists_url":"https://api.github.com/users/Wenzhi/gists{/gist_id}","starred_url":"https://api.github.com/users/Wenzhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wenzhi/subscriptions","organizations_url":"https://api.github.com/users/Wenzhi/orgs","repos_url":"https://api.github.com/users/Wenzhi/repos","events_url":"https://api.github.com/users/Wenzhi/events{/privacy}","received_events_url":"https://api.github.com/users/Wenzhi/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T04:11:33Z","updated_at":"2016-03-19T04:11:33Z","body":"Hi @ldiqual,\r\n\r\nHere is our orientation-related codes for in-app message:\r\n\r\nThe default values for the `supportedOrientations` and `supportedOrientationMasks` are \r\n```\r\n_supportedOrientations = UIInterfaceOrientationPortrait | UIInterfaceOrientationLandscapeRight |\r\n        UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationPortraitUpsideDown;\r\n_supportedOrientationMasks = UIInterfaceOrientationMaskAll;\r\n```\r\nIn the in-app message's view controller:\r\n```\r\n- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {\r\n  return self.supportedOrientations;\r\n}\r\n- (NSUInteger)supportedInterfaceOrientations {\r\n  return self.supportedOrientationMasks;\r\n}\r\n- (BOOL)shouldAutorotate {\r\n  return YES;\r\n}\r\n```\r\n\r\nPlease note that for method `supportedInterfaceOrientations`, the return type should be `UIInterfaceOrientationMask`; we will update our code. But given that `UIInterfaceOrientationMask` is NSUInteger according to [Apple's documentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/index.html#//apple_ref/doc/c_ref/UIInterfaceOrientationMask), I don't think that is the reason for the crash.\r\n\r\nCould 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?\r\n\r\nPlease let me know if you want any more information about code in Appboy.\r\n\r\nThanks,\r\nWenzhi"}}