這是迄今爲止發生在我身上的最奇怪的事情。所以我有一個單元測試代碼如下...aStoryboard.instantiateViewControllerWithIdentifier(「myid」)在lldb中返回零但不爲零
let aStoryboard = UIStoryboard(name: "myStoryboard", bundle: nil)
let viewController = aStoryboard.instantiateViewControllerWithIdentifier("myViewController") as? CustomViewController
上面的代碼執行和ViewController是零,沒關係,可以發生(它不應該,因爲這兩個標識碼和文件鏈接到測試目標),但是沒關係。
這裏的瘋狂的部分,當我添加斷點,步驟在上面的行,然後鍵入以下LLDB
viewController = aStoryboard.instantiateViewControllerWithIdentifier("myViewController") as? CustomViewController
的viewController被分配有存儲器。怎麼樣?如果我手動添加這個在lldb中,那麼它有記憶,如果我沒有,那麼它沒有內存,它是零的單元測試。
有人幫我!
您是否已將CustomController添加爲UnitTest目標的一部分? – Harsh
是的,它被添加爲故事板膨脹 – harmeet07