[英]FBSDKGraphRequest not working
最近幾天,我一直在努力使Facebook SDK在IOS上快速運行。 我可以使登錄正常工作,但無法獲取個人資料信息。 代碼如下。 在這里輸入代碼
func fetchProfile()
{
print("Inside fetchProfile()")
let params = ["fields": "id, first_name, last_name, middle_name, name, email, picture"]
let request = FBSDKGraphRequest(graphPath: "me", parameters: params)!
print("before fetch")
request.start(completionHandler: { (connection, result, error) -> Void in
if ((error) != nil)
{
// Process error
print("Error: \(String(describing: error))")
}
else
{
print(result)
}
}
)
}
我調試了代碼,看到函數request.start()被調用並立即返回而不打印任何內容。 沒有錯誤,但沒有輸出。 不知道發生了什么。.我在網上瀏覽了該解決方案,但無濟於事。
我的AppDeligate有此代碼
enter code here
func application(application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return FBSDKApplicationDelegate.sharedInstance().application(application, open: url as URL!, sourceApplication: sourceApplication, annotation: annotation)
}
任何幫助將不勝感激。
let request = FBSDKGraphRequest(graphPath: "me", parameters: nil)!
嘗試將nil作為參數傳遞,看看請求返回什么。 用戶可能未授予權限,或者您可能寫錯了權限。 我沒有收到任何回復,所以我正在盡力幫助您。 讓我知道它是否無效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.