I keep getting back an empty array from the FBSDK even though my user account in Facebook is marked as attending 4 upcoming events.
Here is my code
func loadEvents() {
let parameters = ["fields": "id, name, place"]
FBSDKGraphRequest(graphPath: "me/events", parameters: parameters).start { (connection, result, error) -> Void in
if ((error) != nil) {
print("Error")
print("Error getting events \(String(describing: error))");
}
print(result)
if let result = result as? [String: Any] {
if let data = result["data"] as? NSArray {
//print(data)
}
}
}
And the result im getting in data is the following:
["data": <__NSArray0 0x60c00000b410>(
) ]
Any help appreciated. Is this a permissions issue? or am i passing in the wrong parameters object?
OK it was a permissions issue. I needed to add the user_events permission when login.
loginButton.readPermissions = ["public_profile", "user_events"]