1

I've integrated the Facebook sso for iOS and have the single sign on implemented and working. How would I go about displaying a user's profile name and image through the Facebook instance for iOS.

I'm unable to find a tutorial for this (that's recent) and am a little confused. any help would be great. thanks.

hanumanDev
  • 6,592
  • 11
  • 82
  • 146

1 Answers1

2

Use Graph API and go through it in facebook site http://developers.facebook.com/docs/mobile/ios/build/

Try this document in that link

enter image description here

Dinesh Raja
  • 8,501
  • 5
  • 42
  • 81
  • thank you. after [facebook requestWithGraphPath:@"me" andDelegate:facebook]; could I then set that value to a string like: NSString *me = [[NSString alloc] initWithFormat:@"%@", [facebook requestWithGraphPath:@"me" andDelegate:facebook]]; ? – hanumanDev Mar 29 '12 at 09:19
  • 1
    No. check below that. There is a method request:didLoad: method to get a successful callback. You will get a data in that method. – Dinesh Raja Mar 29 '12 at 09:24
  • so if I use: - (void)request:(FBRequest *)request didLoad:(id)result { [facebook requestWithGraphPath:@"me" andDelegate:facebook]; } how would I then call that from another method? thanks for all your help by the way. – hanumanDev Mar 29 '12 at 10:18
  • oh oh .. not like that. You just [facebook requestWithGraphPath:@"me" andDelegate:facebook]; call this wherever you want. The result about the user will get in that method - (void)request:(FBRequest *)request didLoad:(id)result { NSLog(@"%@",result); } like this.Try that. – Dinesh Raja Mar 29 '12 at 10:57
  • any idea why I would be getting the warning Sending 'ProjectAppDelegate *' to parameter of incompatible type 'id' from [facebook requestWithGraphPath:@"platform/posts" andDelegate:self]; – hanumanDev Mar 29 '12 at 12:55
  • 2
    - (void)request:(FBRequest *)request didLoad:(id)result { NSLog(@"%@",result); } is a FBRequestDelegate method. You have to include in your view controller like @interface viewController:UIViewController{ } in the top. – Dinesh Raja Mar 29 '12 at 13:35
  • I had for protocols. thanks for that! I still don't see an output message in the console though for - (void)request:(FBRequest *)request didLoad:(id)result { NSLog(@"%@",result); } – hanumanDev Mar 29 '12 at 14:20
  • Try this..[facebook requestWithGraphPath:@"me" andDelegate:self]]; – Dinesh Raja Mar 29 '12 at 14:37
  • I have that in my applicationDidFinishLaunching method. I think what I'm missing is how to call the - (void)request:(FBRequest *)request didLoad:(id)result {...} method from the applicationDidFinishLaunching method. I'm not sure how to do this. thanks again – hanumanDev Mar 29 '12 at 14:51
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/9473/discussion-between-r-a-and-hanumandev) – Dinesh Raja Mar 29 '12 at 14:55