Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Malthe Pedersen
2,338 PointsSwift Parse problem with prepareForSegue
I have a problem with the following code. I get the error: "Type UIStoryboardSegue does not conform to protocol StringLiteralConvertible" AND also the error: "Implicit use of self in closure; to make capture semantics explicit"
Can anyone help me, with what to do here?
@IBAction func loginTapped(sender: UIButton) { PFUser.logInWithUsernameInBackground(usernameLabel.text, password: passwordLabel.text) { (user: PFUser!, error: NSError!) -> Void in if user != nil { prepareForSegue("showLoggedinSegue", sender: self) } else { println("Error") } } }
3 Answers
Malthe Pedersen
2,338 PointsIt works with this code: self.performSegueWithIdentifier("loginSegue", sender: self)
Nick Johnson
11,194 PointsDid you try turning it off and back on?
-apple support
Malthe Pedersen
2,338 PointsI'll try again with the code :-)
@IBAction func loginTapped(sender: UIButton) {
PFUser.logInWithUsernameInBackground(usernameLabel.text, password: passwordLabel.text) {
(user: PFUser!, error: NSError!) -> Void in
if user != nil {
prepareForSegue("showLoggedinSegue", sender: self)
} else {
println("Error")
}
}
}
The identifier is "showLoggedinSegue"
Dominic Bryan
14,452 PointsDominic Bryan
14,452 PointsIts hard to help with it written out like this, can you post it again in code format and what is the identifier for the segue? the story board identifier?