我有两个用户登录,其中publish_actions设置为好友,但在两个用户/ appID /得分上只返回一个用户的分数。两者都成功发布分数。
这是发布代码:
FBSDKGraphRequest(
graphPath: "/me/scores",
parameters: ["score" : finalScore], HTTPMethod: "POST").startWithCompletionHandler { (connection, result, error) in
if error != nil {
print(error)
}
NSNotificationCenter.defaultCenter().postNotificationName(SPostedScoreNotification, object: nil)
complete()
}
这是检索代码:
dispatch_async(dispatch_get_main_queue(), {
FBSDKGraphRequest(graphPath: "/" + appID + "/scores", parameters: ["fields" : "user,score"]).startWithCompletionHandler { (connection, result, error) in
var fbScores = [FBScore]()
guard
let validResult = result,
let data = validResult["data"] as? [[String : AnyObject]]
else {
complete(fbScores)
return
}
for scoreData in data {
if let fbScore = FBScore(attributes: scoreData) {
if NSCalendar.currentCalendar().isDateInToday(fbScore.date) {
fbScores.append(fbScore)
}
}
}
complete(fbScores)
}
})
答案 0 :(得分:1)
想出来。
您必须先请求public_profile和user_friends,然后再发出publish_actions。我只是在请求publish_actions。
不得将publish_actions设置为only_me。