OGeek|极客世界-中国程序员成长平台

标题: ios - 段错误 : 11 when running tests (XCode 8, Swift 2.3) [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:44
标题: ios - 段错误 : 11 when running tests (XCode 8, Swift 2.3)

自从使用 Swift 2.3 将我的 Swift 和 Objective-c 混合项目迁移到 XCode 8 后,每次我在更改任何内容后运行测试时都会收到“命令因信号而失败:段错误:11”错误的测试文件。

当我单击错误以获取更多信息时,我看到:

<module-includes>:1:9: note: in file included from <module-includes>:1: 
#import "Headers/Utilities.h"
    ^
/Users/.../Utilities.framework/Headers/Utilities.h:18:9: error: include of non-modular header inside framework module 'Utilities'
#import <Utilities/NSString+Utilities.h>
^

而且基本上只是一堆类似的错误,以以下结尾:

<unknown>:0: error: could not build Objective-C module 'Utilities'

本例中的实用程序是我制作的一个框架。 Utilities.h 文件中的所有标题都使用尖括号导入,并且标题标记为公共(public)。

在发生段错误后,它将正常运行,直到我对测试文件进行更改。它仅在测试时出现此问题,而不是在构建或运行时。

我尝试过的其他事情:

任何帮助将不胜感激。



Best Answer-推荐答案


这是 sift2.3 中由于内存分配的问题。

如果您从实用程序返回任何对象或方法,请尽量避免将方法保留在同一个类中,还要清理代码并清除派生数据并运行

关于ios - 段错误 : 11 when running tests (XCode 8, Swift 2.3),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39882102/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4