[問題] Swift使用SDK取得Facebook使用者資訊

作者: workhome2 (^^)   2015-10-24 00:09:41
各位前輩好,我是swift開發的新手...
使用SWIFT取得FACEBOOK取得登入者個人資訊時
一直跑出以下error
canOpenURL: failed for URL: "fbauth2:/" - error: "(null)"
Error: Error Domain=com.facebook.sdk.core Code=8 "(null)"
第一條上網查好像只是個warnning可以忽略
但一直找不到第二個錯誤怎麼解
以下是我的source code,麻煩各位前輩幫忙了!
我是使用XCODE7.0
override func viewDidLoad() {
super.viewDidLoad()
if (FBSDKAccessToken.currentAccessToken() != nil)
{
}
else
{
self.view.addSubview(loginView)
loginView.center = self.view.center
loginView.readPermissions = ["public_profile", "email"
, "user_friends"]
loginView.addTarget(self, action: "returnUserData",
forControlEvents: UIControlEvents.TouchUpInside)
loginView.delegate = self
}
}
func returnUserData()
{
let graphRequest : FBSDKGraphRequest =
FBSDKGraphRequest(graphPath: "me", parameters:
["fields": "public_profile, email, user_friends"] )
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)")
}
})
}
作者: LEwww1290 (0.0)   2015-10-24 00:59:00
plist 要設定 應該是這個 http://bit.ly/1NdrOuY

Links booklink

Contact Us: admin [ a t ] ucptt.com