Hi there!
Im making this app, and I need to save the users profile picture in large size to the database.
Heres some code:
if ((FBSDKAccessToken.currentAccessToken()) != nil) {
let parameters = [“fields”: “email, first_name, last_name, picture.type(large), birthday, likes”]
FBSDKGraphRequest(graphPath: “me”, parameters: parameters).startWithCompletionHandler({ (connection, result, error) -> Void in
print(“RESULT FROM FACEBOOK: (result)”) //All good here!
if (error == nil) {
let fields:[String: String] = [
“id” : “facebookId”,
“name” : “name”,
“first_name” : “firstName”,
“last_name” : “lastName”,
“email”: “email”,
“birthday” : “birthday”,
“picture”: “imageUrl”
]
completion(token: FBSDKAccessToken.currentAccessToken(), fields: fields, error: nil)
The completion takes the fields to the login-function provided by backendless, but my problem is, that now suddenly the picture is the small-size image, and not the larger one that i requested, and actually got back from Facebook in the result.
It seems like the field HAS to be names picture - i’ve tried to rename it to picture.type(large) in the fields, but then it doesnt save anything at all. Am I missing something?
Hope my question is clear…
Just to recap, all i want, is to save the url for the image I get back from facebook in the result, and not the small one that I get saved, by writing “picture” in the login-fields…
Oh and btw, how can i get just the url, and not the data-object that facebook returns - its not really possible form e to save just the url to the backendless db… But it seems like its a common problem - anything you would suggest here?
Best regards,
Nicolai