0
編輯:這個問題有點有點愚蠢。如在answer中一樣,問題是我沒有給出我想要的參數。無法從Swift中從Facebook獲取電子郵件
我不能通過它了:)可能是什麼問題?
func returnUserData()
{
let graphRequest : FBSDKGraphRequest = FBSDKGraphRequest(graphPath: "me", parameters: nil)
graphRequest.startWithCompletionHandler({ (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
print("Error: \(error)")
}
else
{
print("fetched user: \(result)")
let userName : NSString = result.valueForKey("name") as! NSString
print("User Name is: \(userName)")
let userEmail : NSString = result.valueForKey("email") as! NSString
print("User Email is: \(userEmail)")
}
})
}
我調用該函數那樣:
func loginButton(loginButton: FBSDKLoginButton!,
didCompleteWithResult result: FBSDKLoginManagerLoginResult!,
error: NSError!) {
print("User Logged In")
if ((error) != nil)
{
// Process error
} else if result.isCancelled {
// Handle cancellations
} else {
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if result.grantedPermissions.contains("email")
{
// Do work
returnUserData()
}
}
}
我得到的錯誤:
我的問題是關於致命錯誤。但是,我很樂意等待輸出結果的第2行和第3行的評論。因爲,我每次都得到這個輸出,但應用程序運行正常。
你的域參數是零它作爲你的錯誤消息指出「作爲圖形API v 2.4 GET請求,我應該包含明確的領域參數」 – pbush25