accessing app delegate object in XCTestCase class causes misaligned_stack_error_ swift

空扰寡人 提交于 2019-12-11 07:57:48

问题


I am trying to perform unit testing in swift.

I defined my test case class like this:

import XCTest
import CoreData
import UIKit

class LazyLoadingCheckTests: XCTestCase {

    var appDelegate : AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate

    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }

    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() {
        // This is an example of a functional test case.
        XCTAssert(true, "Pass")
    }
}

Whenever I am trying to execute a test case, the breakpoint is automatically stopping at below line:

It shows below stack trace:

When I try to continue it shows this:

Any clues?

来源:https://stackoverflow.com/questions/25256355/accessing-app-delegate-object-in-xctestcase-class-causes-misaligned-stack-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!