'Nested syntax to use on Facebook Graph API request

I want to receive a larger profile picture than the standard 50px one that returns.

I can receive email etc no problem, but how do I pass fields to indicate that I want a larger profile picture. I am clear that you can pass nested parameters to picture to return a larger one, but I cannot find information on how to write this when dealing with the Facebook iOS SDK.

extension LoginManagerLoginResult {
      func graphData() {
        let params = ["fields": "first_name, last_name, email, picture{height: 1000}"]
        let graphRequest = GraphRequest(
            graphPath: "me",
            parameters: params,
            tokenString: self.token!.tokenString,
            version: nil,
            httpMethod: .get
        )
        graphRequest.start { graph, any, error in
            debugPrint(any)
            debugPrint(error)
            debugPrint(graph)
        }
    }
}


Solution 1:[1]

I had the syntax wrong. To get pictures off different sizes you can pass fields like below:

let params = ["fields": "first_name, last_name, email, picture.width(1000)"]

You can also pass:

picture.type(large)

or:

picture.height(300)

Or other height values as required.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 paul_f