how to get user's facebook profile pic via fbconnect in my app iphone ?
+1
A:
Try look deeper through http://developers.facebook.com/docs/api. Here is a link to userpic:
http://graph.facebook.com/000000000/picture
Where 000000000
is an id of user logged.
NR4TR
2010-09-24 07:01:14
+2
A:
Here use these delegate methods to get the picture of user.
When you create session you will get the delegate method called didLogin
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
isLoginSuccessful = TRUE;
if(isLoginCanceled == FALSE) {
[self fetchUserDetails];
}
}
- (void)sessionDidNotLogin:(FBSession*)session {
isLoginSuccessful = FALSE;
isLoginCanceled = TRUE;
}
- (void)sessionDidLogout:(FBSession*)session {
isLoginSuccessful = FALSE;
isLoginCanceled = TRUE;
}
- (void)fetchUserDetails {
NSString* fql = [NSString stringWithFormat:
@"select name,sex,pic from user where uid == %lld", _session.uid];
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];
[[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
}
after calling the method requestWithDelegate you'll get response in this method if succeed
- (void)request:(FBRequest*)request didLoad:(id)result {
if ([request.method isEqualToString:@"facebook.fql.query"]) {
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSLog(@"User Details %@",user);
if(fbUserDetails == nil) {
self.fbUserDetails = [[NSDictionary alloc] initWithDictionary:user];
}
if(isLoginSuccessful) {
NSString *fbUid = [NSString stringWithFormat:@"%lld",_session.uid];
self.FBUserID = fbUid;
[_delegate loggedInFaceBookSuccessfully:fbUid];
}
}
}
You'll get all the details in json format you can see in GDB
Rahul Vyas
2010-09-24 07:16:01
thanx rahul its works.....
suchita
2010-09-24 11:57:28
suchita
2010-09-24 12:28:42
I get solution .........
suchita
2010-09-25 04:24:39