Ios 为什么我的迅捷套件会崩溃?
我正在尝试测试我的应用程序。我使用的是在项目第一次创建时由Xcode为我创建的UITest设置。该应用程序大量使用CoreText和属性字符串Ios 为什么我的迅捷套件会崩溃?,ios,xcode,xcode7-beta4,xcode-ui-testing,Ios,Xcode,Xcode7 Beta4,Xcode Ui Testing,我正在尝试测试我的应用程序。我使用的是在项目第一次创建时由Xcode为我创建的UITest设置。该应用程序大量使用CoreText和属性字符串 2015-09-02 14:11:05.958 my_app[66864:11465921] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITextView _baselineOffsetFromBottom]
2015-09-02 14:11:05.958 my_app[66864:11465921] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITextView _baselineOffsetFromBottom] only valid when using auto layout'
*** First throw call stack:
(
0 CoreFoundation 0x007da214 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x02531e42 objc_exception_throw + 50
2 CoreFoundation 0x007da0aa +[NSException raise:format:arguments:] + 138
3 Foundation 0x00e1aad2 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
4 UIKit 0x01bdffff -[UITextView _baselineOffsetFromBottom] + 209
5 UIKit 0x01b09579 -[UIView(UIConstraintBasedLayout) _alignmentDebuggingOverlayCreateIfNecessary:] + 608
6 UIKit 0x0127d22d -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1080
7 libobjc.A.dylib 0x025460f9 -[NSObject performSelector:withObject:] + 70
8 QuartzCore 0x0382c134 -[CALayer layoutSublayers] + 148
9 QuartzCore 0x0381ff28 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 388
10 QuartzCore 0x0381fd8c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 26
11 QuartzCore 0x03812c6b _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 317
12 QuartzCore 0x0384643b _ZN2CA11Transaction6commitEv + 589
13 QuartzCore 0x03846cee _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
14 CoreFoundation 0x006f464e __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 30
15 CoreFoundation 0x006f45ae __CFRunLoopDoObservers + 398
16 CoreFoundation 0x006e9758 CFRunLoopRunSpecific + 504
17 CoreFoundation 0x006e954b CFRunLoopRunInMode + 123
18 UIKit 0x011b81af -[UIApplication _run] + 540
19 UIKit 0x011bd38f UIApplicationMain + 160
20 my_app 0x000680bc main + 140
21 libdyld.dylib 0x03feda21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我的单元测试完全是普通的
import XCTest
class my_appUITests: XCTestCase {
override func setUp() {
super.setUp()
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
XCUIApplication().launch()
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
super.tearDown()
}
func testExample() {
// Use recording to get started writing UI tests.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
}
我使用的是Xcode 7 Beta 4,这是该特定版本中的一个bug吗?还是我遗漏了一些关于UITests和autolayout的内容 升级似乎让我克服了这个错误,但给我留下了一个全新的错误。我希望这是因为Xcode7仍处于测试阶段,而不仅仅是因为他们将UITests置于这种状态。看起来崩溃发生在应用程序中,而不是UI测试中。引发的实际异常状态为:
-[UITextView\u baselineOffsetFromBottom]仅在使用自动布局时有效
我理解。但是,除了UITests,我无法在任何地方重现这种崩溃。如果我只是构建并运行应用程序,就不会发生这种情况。所以UITests中一定有什么东西触发了崩溃。