本文介绍了自 swift 2.2 起,泛型类测试崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自从更新到 Swift2.2 后,我的测试在如下所示的行中崩溃,出现 EXC_BAD_ACCESS (code=2, address=0xb6bc48):

Since the update to Swift2.2 my tests crash with EXC_BAD_ACCESS (code=2, address=0xb6bc48) at a line that looks like this:

let myLet = MyGenericClass<MyType>(some: 0, parameters: 1)

在调试导航器中,我可以看到它停在

At the debug navigator I can see that it stops at

0 swift_initClassMetadata_UniversalStrategy
...snip...
6 type metadata accessor for MyGenericClass<MyType>
7 MyClassTests.theTestIAmExecuting() -> ()
...snip...

我使用 @testable import MyApp 导入类,而不是将所有经过测试的类添加到测试目标中,这可能与某些事情有关.

It may have something to do that I import the classes with @testable import MyApp instead of adding all my tested classed to the test target.

有人遇到同样的问题吗?有人有办法解决这个问题吗?

Is anyone having the same issue? anyone got a way to solve this?

更新

当我现在运行我的项目时它也崩溃了

It also is crashing when I run my project now

推荐答案

我正在努力解决类似的问题,请参阅 https://bugs.swift.org/browse/SR-815(仅适用于 iOS7 崩溃)并投票支持此错误,如果它是相同的问题

I am struggling with similar problem, please see https://bugs.swift.org/browse/SR-815 (crash only for iOS7) and vote for this bug if it is the same problem

这篇关于自 swift 2.2 起,泛型类测试崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 04:17