I tried this:
meurl = [NSURL URLWithString:@"https://graph.facebook.com/me/picture"];
SLRequest *imageReq =[SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:meurl parameters:nil];
imageReq.account = self.facebookAccount;
[imageReq performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (error) {
NSLog(@"error -%@", [error debugDescription]);
}else{
NSString *meDataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"image -%@", meDataString);
}
}];
But I get image - (nil)
.
I have an other request right above that code for user info and I get all the data just fine.
The picture is in your responseData variable
you can use this:
to view the image hex values
You can get you picture using
https://graph.facebook.com/XXXXXX/picture
where XXXXXX is your id on FB.
To get your id you can use:
https://graph.facebook.com/me
@shannoga - You are almost on the right path. Instead of me in your request, you have to use the Facebook user id. For that first make this request to get the user details - https://graph.facebook.com/me . Then from this request, get the user id in the handler from the json parsed response data. Using this user id, make this request - https://graph.facebook.com/userid/picture. In the response, you will get the response data which is your profile image data.