Facebook SDK v4.0 für iOS - FBSDKProfile currentProfile wird nicht festgelegt
Ich habe gerade mein Facebook SDK für meine iOS-App auf 4.0 "aktualisiert".
Ich habe das Login funktioniert, aber laut Dokumentation soll ich jetzt @ verwendeFBSDKProfile.currentProfile()
, um auf die Profilinformationen zuzugreifen.
Dieser Wert scheint jedoch immer @ zu senil
, obwohl mein Profilbild angezeigt wird (durch einFBSDKProfilePictureView
) und meinFBSDKAccessToken.currentAccessToken()
ist nichtnil
.
Dies ist mein LoginViewController:
import UIKit
class LoginViewController: UIViewController, FBSDKLoginButtonDelegate {
@IBOutlet weak var fbLoginButton: FBSDKLoginButton!
@IBOutlet weak var fbProfilePicture: FBSDKProfilePictureView! //displays a picture
override func viewDidLoad() {
super.viewDidLoad()
self.fbLoginButton.delegate = self
FBSDKProfile.enableUpdatesOnAccessTokenChange(true)
if FBSDKAccessToken.currentAccessToken() != nil {
println("\(FBSDKAccessToken.currentAccessToken().userID)") //works
}
self.fbLoginButton.readPermissions = ["public_profile", "email", "user_friends"]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
println(FBSDKProfile.currentProfile()) //is nil
}
func loginButtonDidLogOut(loginButton: FBSDKLoginButton!) {
}
}
Irgendwelche Ideen