Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I get the full User object using Facebook Graph API and facebook ios sdk?
    primarykey
    data
    text
    <p>I'm using the <a href="https://github.com/facebook/facebook-ios-sdk/" rel="nofollow">Facebook iOS SDK</a> and Facebook Graph API. When I request "me", which should return all the properties of the current user, I'm only actually getting a small subset of the User object. What am I doing wrong?</p> <p>I'm also not getting the Allow / Don't Allow dialog when I log in, but perhaps that is because I am the app owner?</p> <p>In my header:</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; #import "Facebook.h" @interface FacebookAppViewController : UIViewController &lt;FBRequestDelegate, FBDialogDelegate, FBSessionDelegate&gt; { Facebook* facebook; NSArray* permissions; IBOutlet UILabel* JSONLabel; } @property (retain, nonatomic) UILabel* JSONLabel; - (IBAction)login:(id)sender; - (IBAction)logout:(id)sender; @end </code></pre> <p>In my implementation:</p> <pre><code>#import "FacebookAppViewController.h" static NSString* apiKey = @""; // with my app ID @implementation FacebookAppViewController @synthesize JSONLabel; - (IBAction)login:(id)sender { [facebook authorize:apiKey permissions:permissions delegate:self]; } - (void) fbDidLogin { [facebook requestWithGraphPath:@"me" andDelegate:self]; } - (void)request:(FBRequest*)request didLoad:(id)result { NSString* uid = [result objectForKey:@"id"]; if ([result isKindOfClass:[NSDictionary class]]) { NSString* text = @""; NSDictionary* hash = result; for (NSString* key in hash) { text = [text stringByAppendingFormat:@"\n%@: ", key]; NSObject* value = [hash objectForKey:key]; if (value == nil) { NSLog(@"value is nil"); continue; } if ([value isKindOfClass:[NSString class]]) { NSString* str = value; text = [text stringByAppendingFormat:@"%@", str]; } JSONLabel.text = text; } } } - (void)viewDidLoad { [super viewDidLoad]; facebook = [[Facebook alloc] init]; } - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { permissions = [[NSArray arrayWithObjects:@"read_stream", @"offline_access", nil] retain]; } return self; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload