jeudi 2 juillet 2015

Cannot access AppDelegate while testing Xcode project

func testExample() {
    let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
    // some code ...
}

The above function always crash and gives this error:

Could not cast value of type 'MyAppName.AppDelegate' (0x10dc09e80) to 'MyAppNameTests.AppDelegate' (0x11cc190c0).

Aucun commentaire:

Enregistrer un commentaire