Reputation: 2593
I have two users logged in with publish_actions set to friends but on both users /appID/scores only returns one user's scores. Both are posting scores successfully.
Here is the posting code:
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()
}
And here is the retrieving code:
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)
}
})
Upvotes: 0
Views: 160
Reputation: 2593
Figured it out.
You must request public_profile and user_friends first and then publish_actions. I was only requesting publish_actions.
publish_actions must not be set to only_me.
Upvotes: 1