- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
类似问题的答案没有帮助,所以我提出了一个新问题。
我现在在我的几个项目中都遇到了这个问题:
点击第一响应者 UITextField
或 UITextView
(通常会调出用于复制和粘贴的默认上下文菜单)会导致我的应用程序崩溃.
注意 UICalloutBarButton
是一个UIKit
私有(private)API,所以没有机会改变它的layoutSubviews
实现并在其中调用 [super layoutSubviews]
。
日志消息:
*** Assertion failure in -[UICalloutBarButton layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2935.137/UIView.m:8794
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UICalloutBarButton's implementation of -layoutSubviews needs to call super.'
我不知道为什么会出现这种情况。非常乐意提供任何帮助。
编辑
尝试在演示项目中重现崩溃,我发现是自定义 UIView
类别导致了崩溃。有关详细信息,请参阅已接受的答案。
最佳答案
通过尝试在演示项目中重现崩溃,我发现它是导致崩溃的自定义 UIView 类别。
创建此错误时,我假设类别方法仅适用于 #import
此类别的 UIView
子类。
但事实并非如此 Apple Documentation :
Any methods that you declare in a category will be available to all instances of the original class, as well as any subclasses of the original class. At runtime, there’s no difference between a method added by a category and one that is implemented by the original class.
所以没有意识到这一点,我在我的自定义类别中覆盖了 UIView
方法 + (BOOL) requiresConstraintBasedLayout
以返回 YES
(就像我错误地认为只针对那些导入该类别的类)。
在那个方法中放置一个断点,我了解到一旦将类别文件添加到项目中,就会从 UIKit 中的任何地方调用这个“类别方法”。
不过是一种痛苦的学习/接受方式,覆盖类别中的方法永远不是一个好主意 - 除非你想造成像这样的奇怪崩溃;-)。
很抱歉耽误了您的时间,但感谢您询问了一些代码示例,这些示例迫使我认真地重现了这个问题——这导致了我的崩溃原因……
关于ios - 点击 UITextField 或 UITextView 时崩溃 : Assertion failure in -[UICalloutBarButton layoutSublayersOfLayer:],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27405915/
应用程序在模拟器上运行良好,但我无法在我的设备(小米 Mi4)上启动应用程序。起初我用这样的文字播种对话: Installation failed with message Failed to est
尽管使用了唯一的模块名称(例如 THIS 不是手头的问题),但在 kadena 的测试网上部署我的智能合约失败并显示以下错误消息: : Failure: Tx Failed: Keyset failu
简而言之 - 我正在尝试从 plist 中获得高分 这是读取数据的代码: var myOutput: AnyObject? = NSUserDefaults.standardUserDefau
在 Xcode(7.2 和 7.3) 中进行 UI 测试时,我的测试有时会失败并出现相当一般性的错误: Assertion Failure: UI Testing Failure - Failure
我正在尝试向 BizTalk 发送 HL7 消息并收到错误代码 0xC0C01B4e(路由失败报告)和消息: Routing Failure Report for 我已经在最后一天工作了,现在收到这
我对 scrapy 还很陌生,我正在尝试使用一些代理来抓取一些 craigslist 页面,但我收到了一些错误,如下所示。我尝试了命令 scrapy shell "https://craigslist
我正在尝试使用来自服务器的给定链接使用 URL 类下载一些内容。 我要下载的代码是: URL url = new URL(downloadUrl); I
我正在做一个数据抓取项目,我的代码使用了 Scrapy(版本 1.0.4)和 Selenium(版本 2.47.1). from scrapy import Spider from scrapy.se
我正在设置 ADF 管道以将 blob 复制到 Azure SQL DB。我的管道中有一个迭代事件,其中我设置了一个计数器,仅当 blob 存在时才进行循环和复制。 除了一些随机的 PK 违规之外,这
我正在设置 ADF 管道以将 blob 复制到 Azure SQL DB。我的管道中有一个迭代事件,其中我设置了一个计数器,仅当 blob 存在时才进行循环和复制。 除了一些随机的 PK 违规之外,这
如果 junit 测试的结果为“失败”,这到底意味着什么?我假设测试期间发生了异常,但我找不到任何有关它的信息。失败跟踪中的行也是: Assert.assertTrue(result); 其中结果只是
我正在制作这个控制台应用程序,用户必须在其中输入内容。然而,当代码到达用户输入文件名的部分,然后使用 strcat 将其添加到文件路径中时,它会输出段错误。完整代码如下: int main(int a
如何解决这个问题?命令 ionic cordova 构建 android 失败:构建因异常而失败。 出了什么问题: 无法启动守护进程。此问题可能是由于守护程序配置不正确造成的。例如,使用了无法识别的
当我尝试在我的设备而不是 Android 虚拟设备上运行应用程序时,它给出错误并停止运行。 在控制台上显示这些消息。 打开:权限被拒绝 pkg:/data/local/tmp/com.example.
今天我下载了 Android Studio v 0.8.0 beta。我正在尝试在 SDK 17 上测试我的应用程序。 Android Studio 错误 Failure [INSTALL_FAILE
我使用 Meizu MX6 在 Android Studio 上工作。以前一切正常。但似乎在更新 Flyme 之后,我开始遇到这个问题: Failure [INSTALL_FAILED_USER_RE
这个问题在这里已经有了答案: List[Try[T]] to Try[List[T]] in Scala (4 个答案) 关闭 2 年前。 如果我有一些验证函数: def validateOne(a
我安装了 Docker 版本“Docker 版本 19.03.8,构建 afacb8b”,当我尝试使用 docker pull 命令时,如“docker pull mcr.microsoft.com/
我正在Xcode 11上构建SwiftUI应用程序,但是当我切换到应用程序中的特定选项卡时,它会立即终止。 问题是,它始终指向Application Delegate文件,我认为这并不是真正的问题。我
所以我这里有一个 Azure 机器学习管道,它由许多 PythonScriptStep 任务组成 - 确实非常基本。 由于网络问题或其他问题,其中一些脚本步骤会间歇性失败 - 确实没有什么意外。这里的
我是一名优秀的程序员,十分优秀!