2

我正在尝试测试我的应用程序。我正在使用首次创建项目时由 Xcode 为我创建的 UITest 设置。该应用程序大量使用 CoreText 和属性字符串。

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,这是该特定版本中的错误吗?或者我错过了关于 UITests 和自动布局的一些东西?

4

0 回答 0