iphone - 将 helpshift 添加到应用程序导致 UIApplicationInvalidInterfaceOrientation 异常

标签 iphone objective-c ios exception orientation

我最近一直在尝试使用 helpshift,但我发现它导致了异常。

异常是说我有 autorotate 返回是,但是我没有在我的任何代码中实现这个方法,根据我的理解,这意味着它被设置为 NO。

如果我向我的应用程序添加不同的方向,它会在我的 iPhone 未处于横向时自动将其设置为横向。

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES' * First throw call stack: (0x36b0d3e7 0x33545963 0x36b0d307 0x37922857 0x37ac6f21 0x37964c8b 0x37a88f73 0x37912761 0x378bacef 0x378ba77d 0x378ba1bf 0x30d9f5f7 0x30d9f227 0x36ae23e7 0x36ae238b 0x36ae120f 0x36a5423d 0x36a540c9 0x37911445 0x3790e291 0x79d95 0x79d30) libc++abi.dylib: terminate called throwing an exception

除了 helpshift API,我还需要添加以下框架:

  • 核心图形
  • QuartzCore(已添加并运行)
  • SystemConfiguration(已添加且有效)
  • 移动核心服务
  • OpenGLES
  • 核心电话
  • 安全
  • 基金会

如果不包含 helpshift,该应用程序将按预期运行。上述任何框架是否会导致我应该解决的 helpshift 问题?有没有可能设置不正确?由于 helpshift 是一个新产品,所以帮助还不完全存在

最佳答案

我在使用 Helpshift SDK 时遇到了同样的问题。它在 1.3.1 版中运行良好,但当我升级到 1.3.4 版时,我的应用程序停止运行并出现 UIApplicationInvalidInterfaceOrientation 错误。除了 Helpshift 升级外没有其他变化,我已经通过降级到 1.3.1(应用程序再次运行)然后再次升级到 1.3.4(应用程序再次崩溃)来确认它。我可以通过将以下内容添加到应用程序委托(delegate)来运行我的应用程序:

-(NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window{
     return UIInterfaceOrientationMaskAll;
}

使用 UIInterfaceOrientationMaskPortrait 会导致崩溃。因为我需要我的应用程序保持纵向,所以我将以下内容添加到我的 UITabBarController 子类中:

-(BOOL)shouldAutorotate{
     return NO;
}

关于iphone - 将 helpshift 添加到应用程序导致 UIApplicationInvalidInterfaceOrientation 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13999738/

相关文章:

ios - 执行选择器可能会因为select未知而导致泄漏?

iphone - 使两个 UIScrollViews 跟随彼此滚动

ios - 背景图像显示在模拟器上但不显示在设备上?

ios - UIAccessibilityCustomAction 选择器未被触发

ios - 动态居中的 UIImagepicker 取景器已放大至全屏

iphone - 如何使用 iPhone 摄像头测量房间内的可见蓝光强度?

iphone - Cocoa/iPhone 中的多点触摸检测

ios - 在 iPhone 上放大背景图像

ios - 在 Xamarin.IOS 中使用 Office 365 API 时出现 NullReferenceException

ios - IOS 包房聊天要不要用SignalR?