In my main ViewController, I have this:
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
println("VIEW CONTROLLER DID APPEAR")
var currentUser = PFUser.currentUser()
println(currentUser)
if (!currentUser) {
self.presentLogInController()
} else {
println("VALID USER")
}
}
When the application starts, this line causes an error:
if (!currentUser) {
with the message EXC_BAD_INSTRUCTION
However, the output window shows:
VIEW CONTROLLER DID APPEAR
<PFUser:TzzzzzzaHx:(null)> {
email = "blah@blah.bla";
username = mmm;
}
VALID USER
Given that code executing outside of the line Xcode says causes EXC_BAD_INSTRUCTION, this does not seem to be a critical error, although this leads to a failure of the simulator and the real device.
Any tips on debugging this?
FOUND SOLUTION
if let user = PFUser.currentUser() {
println("VALID USER")
println(user)
println(user["email"])
println(user["completedTour"])
if !user["completedTour"] {
println("NO TOUR YET")
}
} else {
self.presentLogInController()
}
source
share