This is by far the strangest thing thats happened to me. So I have the code below in a unit test...
let aStoryboard = UIStoryboard(name: "myStoryboard", bundle: nil)
let viewController = aStoryboard.instantiateViewControllerWithIdentifier("myViewController") as? CustomViewController
The code above is executed and viewController is nil, okay that can happen (it shouldn't be because both identifiers exist and files are linked to test targets) but yeah okay.
Here's the crazy part, when I add a breakpoint, step over the lines above and then type the following into lldb
viewController = aStoryboard.instantiateViewControllerWithIdentifier("myViewController") as? CustomViewController
viewController is allocated with memory. What how? If I manually add this in lldb then it has memory if I don't then it doesn't have memory and it's nil for the unit test.
Someone help me!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…