Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should use this code (I use it with Hackbook code sample and it works perfectly):</p> <p>On APICallsViewController.m add those functions:</p> <pre><code>/* /* Graph API: Method to get the user's friends. */ - (void)apiGraphFriendsWithBirthdays { [self showActivityIndicator]; HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate]; NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys: @"picture,id,name,link,birthday,gender,last_name,first_name",@"fields", nil]; [[delegate facebook] requestWithGraphPath:@"me/friends" andParams:params andHttpMethod:@"GET" andDelegate:self]; </code></pre> <p>}</p> <p>The above would fetch lots of data, You can use only id,name and birthday...</p> <pre><code>/* * Helper method to first get the user's friends and birthdays then * do something with it. */ - (void)getFriendsForSetBirthday { // Call the friends Birthday API first currentAPICall = kAPIFriendsForSetBirthday; [self apiGraphFriendsWithBirthdays]; } </code></pre> <p>add this to "- (void)request:(FBRequest *)request didLoad:(id)result" on cases section :</p> <pre><code> case kAPIFriendsForSetBirthday: { NSMutableArray *friends = [[NSMutableArray alloc] initWithCapacity:1]; NSArray *resultData = [result objectForKey:@"data"]; if ([resultData count] &gt; 0) { for (NSUInteger i=0; i&lt;[resultData count] &amp;&amp; i &lt; 25; i++) { [friends addObject:[resultData objectAtIndex:i]]; NSDictionary *friend = [resultData objectAtIndex:i]; long long fbid = [[friend objectForKey:@"id"]longLongValue]; NSString *name = [friend objectForKey:@"name"]; NSString *birthday = [friend objectForKey:@"birthday"]; NSLog(@"id: %lld - Name: %@ - Birthday: %@", fbid, name,birthday); } } else { [self showMessage:@"You have no friends."]; } [friends release]; break; } </code></pre> <p>You need to request for permissions for birthday readings (I did it on the likes permission section but you can do it wherever you like, Note that you must request it before it can work):</p> <pre><code>- (void)apiPromptExtendedPermissions { currentAPICall = kDialogPermissionsExtended; HackbookAppDelegate *delegate = (HackbookAppDelegate *)[[UIApplication sharedApplication] delegate]; NSArray *extendedPermissions = [[NSArray alloc] initWithObjects:@"user_likes",@"friends_birthday", nil]; [[delegate facebook] authorize:extendedPermissions]; [extendedPermissions release]; } </code></pre> <p>On the .h file don't forget to add kAPIFriendsForSetBirthday for apicall.</p> <p>On Dataset.m add :</p> <pre><code>NSDictionary *graphMenu7 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Get friends birthday", @"title", @"You can get all friends birthdays.", @"description", @"Get friends birthday", @"button", @"getFriendsForSetBirthday", @"method", nil]; </code></pre> <p>and add graphMenu7 to the menu on this file, and don't forget to release it.</p> <p>I've tested it and it's work perfectly, Hope this helps.</p>
    singulars
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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