I'm using the Facebook iOS SDK in Swift to access Facebook and I would like to work with the FBGraphUser
(or FBGraphPlace
, FBGraphLocation
) protocols rather than with a pure Dictionary
. The request completes successfully but I cannot cast the result to the FBProtocol
FBRequestConnection.startForMeWithCompletionHandler { (connection: FBRequestConnection!, result: AnyObject!, error: NSError!) -> Void in
// this does not work
if let fbGraphUser = result as? FBGraphUser {
NSLog("\(fbGraphUser)")
}
// this works
if let fbGraphUserDict = result as? Dictionary<String, AnyObject>{
println("\(fbGraphUserDict)")
}
}
How am I supposed to unwrap the optionals to get the FBxxxx objects ?
cheers