I am getting swift_dynamiccast unconditional exception while accessing app delegate from test cases in one of the methods in application.
The function in the application is like this:
func sampleMethod()
{
var appdelegate:AppDelegate = UIApplication.sharedApplication().delegate! as AppDelegate
}
Test case is accessing this method as:
func testStart()
{
var sample:MyClass = MyClass()
sample.sampleMethod()
}
It is raising exception in the method sampleMethod(), then it goes ahead. I have added MyClass & AppDelegate files in the test case project in build phases.
Any suggestions whats wrong here? A similar unanswered question here.