We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm doing bridging header but it throw an error message
fatal error: unexpectedly found nil while unwrapping an Optional value
My code
@IBAction func btnLinkedin(sender: AnyObject) { if btnLinkedin.on { client.getAuthorizationCode({ (code:String!) -> Void in println(code) self.client.getAccessToken(code, success: { (accessTokenData) -> Void in if let dict = accessTokenData as? Dictionary<String, AnyObject> { let accessToken: AnyObject? = dict["access_token"] self.requestMeWithToken(accessToken!) } }, failure: { (error:NSError!) -> Void in println("Quering accessToken failed (error)") }) }, cancel: { () -> Void in println("Authorization was cancelled by user") }, failure: { (error:NSError!) -> Void in println("Authorization failed (error)") }) println("Switch is on") btnLinkedin.setOn(true, animated:true) } else { println("Switch is off") btnLinkedin.setOn(false, animated:true) } }
func requestMeWithToken(accessToken: AnyObject){ client.GET("https://api.linkedin.com/v1/people/~?oauth2_access_token=%@&format=json", parameters: nil, success: { (operation:AFHTTPRequestOperation!, result:AnyObject!) -> Void in println("current user \(result)") }) { (operation: AFHTTPRequestOperation!, error:NSError!) -> Void in println("failed to fetch current user \(error)") } }
Please advice.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm doing bridging header but it throw an error message
fatal error: unexpectedly found nil while unwrapping an Optional value
My code
@IBAction func btnLinkedin(sender: AnyObject) {
if btnLinkedin.on {
client.getAuthorizationCode({ (code:String!) -> Void in
println(code)
self.client.getAccessToken(code, success: { (accessTokenData) -> Void in
if let dict = accessTokenData as? Dictionary<String, AnyObject> {
let accessToken: AnyObject? = dict["access_token"]
self.requestMeWithToken(accessToken!)
}
}, failure: { (error:NSError!) -> Void in
println("Quering accessToken failed (error)")
})
}, cancel: { () -> Void in
println("Authorization was cancelled by user")
}, failure: { (error:NSError!) -> Void in
println("Authorization failed (error)")
})
println("Switch is on")
btnLinkedin.setOn(true, animated:true)
} else {
println("Switch is off")
btnLinkedin.setOn(false, animated:true)
}
}
Please advice.
The text was updated successfully, but these errors were encountered: