【问题标题】:How can I track down this crash occurring because of an invalid constraint in my iOS app?我如何追踪由于我的 iOS 应用程序中的无效约束而发生的崩溃?
【发布时间】:2014-05-12 13:46:29
【问题描述】:

我的应用中有 BugSense,用于检测和上传来自用户的崩溃报告。我遇到了以下我无法追踪的崩溃。有人可以给我一些提示,告诉我如何弄清楚这里发生了什么吗?

NSInternalInconsistencyException

    <NSISEngine: 0x1659edd0>{ Rows: UILayoutContainerView:0x165731d0.Height{id: 78} ==
 960 + 1*0x16593640:UIView-Encapsulated-Layout-Height.marker{id: 83} UILayoutContainerView:0x165731d0.Width{id: 75} == 
640 + 1*0x16593610:UIView-Encapsulated-Layout-Width.marker{id: 80} UINavigationTransitionView:0x165743e0.Height{id: 74} == 
960 + 2*0x165a3480.marker{id: 79} + 1*0x16593640:UIView-Encapsulated-Layout-Height.marker{id: 83} UINavigationTransitionView:0x165743e0.Width{id: 72} == 
640 + 2*0


0   CoreFoundation  <redacted> + 130    
1   libobjc.A.dylib objc_exception_throw + 38   
2   CoreFoundation  <redacted> + 0  
3   Foundation  <redacted> + 220    
4   Foundation  <redacted> + 174    
5   Foundation  <redacted> + 316    
6   UIKit   <redacted> + 200    
7   UIKit   <redacted> + 82 
8   Foundation  <redacted> + 210    
9   UIKit   <redacted> + 298    
10  UIKit   <redacted> + 1414   
11  UIKit   <redacted> + 36 
12  UIKit   <redacted> + 1332   
13  UIKit   <redacted> + 72 
14  UIKit   <redacted> + 728    
15  UIKit   <redacted> + 2614   
16  UIKit   <redacted> + 418    
17  UIKit   <redacted> + 44 
18  UIKit   <redacted> + 184    
19  UIKit   <redacted> + 380    
20  QuartzCore  <redacted> + 142    
21  QuartzCore  <redacted> + 350    
22  QuartzCore  <redacted> + 16 
23  QuartzCore  <redacted> + 230    
24  QuartzCore  <redacted> + 314    
25  UIKit   <redacted> + 8232   
26  CoreFoundation  <redacted> + 14 
27  CoreFoundation  <redacted> + 206    
28  CoreFoundation  <redacted> + 622    
29  CoreFoundation  CFRunLoopRunSpecific + 522  
30  CoreFoundation  CFRunLoopRunInMode + 106    
31  GraphicsServices    GSEventRunModal + 138   
32  UIKit   UIApplicationMain + 1136    
33  Video Games main (main.m:16) + 874715   
34  libdyld.dylib   <redacted> + 2

【问题讨论】:

  • 嗯,这是在自定义容器过渡动画期间(UINavigationController,看起来像)。除此之外,如果您需要实际帮助,您可能希望取消编辑您的日志。你比美国国家安全局还要糟糕!
  • 另外,您甚至还没有在顶部完整显示整个 NSISEngine 消息。我可以说是因为它突然结束并且缺少匹配的结束分隔符。请完整复制并粘贴该消息。
  • 这是来自 BugSense 并在设备上进行了符号化。这是尽可能多的信息,我不会在我们的发布应用上打开任何深入日志记录。
  • 那么你就是 scrod(正如他们在波士顿所说的那样)。我很确定您应该查看您的自定义视图控制器转换,所以也许您想发布代码?否则,恐怕也没什么好说的了。
  • 您没有提供任何代码,无论如何,问题是“如何追踪这次崩溃?”如果您发布的内容就是您所知道的,您可以(尝试)通过打开您的源代码并查看您的 UINavigationController 的自定义过渡动画的代码来做到这一点。

标签: ios xcode cocoa-touch constraints


【解决方案1】:

根据Apple's Documentation

NSInternalInconsistencyException

Name of an exception that occurs when an internal assertion fails and implies an unexpected condition within the called code. Available in OS X v10.0 and later. Declared in NSException.h.

您遇到的崩溃可能有很多原因,我们只能指定您是否可以共享一些代码。

您在问题中提到的崩溃日志给我们一些提示如下:

1) 这似乎是自定义过渡动画的问题(如其他所述)。

2)a comment by MaxGabriel所述:

这听起来像是一个自动布局问题(只是猜测,但我知道当应用仿射变换时,框架属性的值是未定义的。也许自动布局正在使用框架?为了测试该理论,您可以删除转换并查看错误是否仍然存在)。

3)an answer by Daniel C中所述

当您在 XCode 之外重命名某些文件时,可能会发生此错误。要解决它,您只需从项目中删除文件(右键单击 - 删除和“删除引用”)您重新导入项目中的文件,一切都会好起来的!

4) 看看这个link,它可能会对你有所帮助。

5)从崩溃日志看来是iPhone4(4/4s)发生了崩溃。

此崩溃是否发生在 iOS 7 或更低版本中?请提及它。它还将帮助我们找到崩溃的原因。

希望这些信息对您有所帮助。

【讨论】:

  • 谢谢,我会根据您的回答深入研究并为您提供更多详细信息。
  • 我只在 iOS7 的 iPhone4/4S 中遇到同样的问题。你能帮我解决这个问题吗?
【解决方案2】:

正如其他人在 cmets 中指出的那样,这似乎是自定义过渡动画的问题。我能从中得到的唯一其他信息是它发生在 3.5 英寸 Retina 屏幕上。

这是在黑暗中的尝试,但是否存在无法在 3.5 英寸屏幕上满足的约束?您可能还想检查是否有自动调整大小的蒙版约束(请参阅 -[UIView translatesAutoresizingMasksIntoConstraints])与自定义约束相矛盾。

要获取更多信息,您必须包含更详细的日志记录或自己重现崩溃。

【讨论】:

  • 感谢您的提示,这些信息可能已经足够继续……您如何确定是 3.5 英寸屏幕导致了问题?
  • UILayoutContainerView 的高度/宽度限制为 960x640,分辨率为 3.5" Retina 屏幕的像素。
  • 其实这是最好的答案。但是,您似乎更有可能将其倒退:如果无法解决的约束是针对 3.5 英寸的屏幕,那么崩溃将发生在 4 英寸的屏幕上。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-05-13
  • 2012-06-08
  • 2015-09-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多