0

I got one sample code (iOS) in which I am getting all user's friends (App Id = 377766775651612) but when I using own created app id (app id 707496825976004), I am getting the list of friends who are using my app.

I want all friends

Please help me

Thanks in advance

4 Answers4

3

This is not possible with Graph API version 2.0.

Vitor
  • 523
  • 2
  • 4
  • 28
  • 3
    Check this answer: http://stackoverflow.com/questions/23417356/facebook-graph-api-v2-0-me-friends-returns-empty-or-only-friends-who-also-u – Vitor Jun 10 '15 at 13:21
1

This is not possible with Graph API version 2.0. Any app made after april 2014 will use 2.0. For more details, see this answer: Get facebook friends with Graph API v.2.0

Community
  • 1
  • 1
0
-(IBAction)permit:(id)sender
 {
   if ( [facebook isEqualToString:@"yes"])
{
     UIAlertView *Alert = [[UIAlertView alloc] initWithTitle: @"Status!"
                                                    message: @"Please Log in first"
                                                   delegate: self
                                          cancelButtonTitle: @"Ok" otherButtonTitles: nil];
    [Alert show];

        }
else
{
    [self requestPermissionAndPost];

}

}
- (void)requestPermissionAndPost {
[FBSession.activeSession requestNewPublishPermissions:[NSArray arrayWithObjects:@"publish_actions",@"publish_stream",@"friends_birthday", nil]
                                      defaultAudience:FBSessionDefaultAudienceFriends
                                    completionHandler:^(FBSession *session, NSError *error) {
                                        if (!error && [FBSession.activeSession.permissions indexOfObject:@"publish_actions"] != NSNotFound) {
                                            [self getFriends];
                                        } else if (error) {
                                            if ([FBErrorUtility errorCategoryForError:error] != FBErrorCategoryUserCancelled) {
                                                NSLog(@"error %@",error);
                                            }
                                        }
                                    }];
 }

  -(void)getFriends
 {
 [self addMBProgress];
NSString *accsstoken=[[[FBSession activeSession]accessTokenData]accessToken];
NSString *abcd=[NSString stringWithFormat:@"https://graph.facebook.com/me/friends?fields=id,name,picture,birthday,location,email&access_token=%@",accsstoken];
NSURL *url = [NSURL URLWithString:abcd];
NSMutableURLRequest *request1 = [NSMutableURLRequest requestWithURL: url];
[request1 setURL:url];
[request1 setHTTPMethod:@"GET"];
NSError *error;
NSURLResponse *response;
urlDataaa = [NSURLConnection sendSynchronousRequest:request1 returningResponse:&response error:&error];
if (urlDataaa!=nil)
{
    if(NSClassFromString(@"NSJSONSerialization"))
    {
        NSError *error = nil;
        id object = [NSJSONSerialization
                     JSONObjectWithData:urlDataaa
                     options:0
                     error:&error];
        if(error)
        {

        }
        if([object isKindOfClass:[NSDictionary class]])
        {
            NSDictionary *results = object;
               NSLog(@"results..:%@",results);
            [self removeMBProgress];
           venues = [results objectForKey:@"data"];
             NSLog(@"birthday..%@",venues);
        }
    }
}
[venues enumerateObjectsUsingBlock:^(NSDictionary *dict,NSUInteger idx,BOOL *stop)
 {
     NSString *namess = [dict objectForKey:@"name"];
     [name addObject:namess];
     if ([dict objectForKey:@"birthday"]) {
         NSString *birthdayss = [dict objectForKey:@"birthday"];
         [birthday addObject:birthdayss];
     }
     else
     {
         [birthday addObject:@"No Birthday"];
     }
   }
  ];

NSString *query1 = [NSString stringWithFormat:@"DELETE from userdata"];
[[DBManager sharedDatabase]executeQuery:query1];
NSLog(@"query1:%@",query1);
userdata = [[DBManager sharedDatabase]userdata:@"select * from userdata"];
NSLog(@"userdata...%@",userdata);
for (int i=0; i<[name count]; i++)
{
    NSString *namesss =[name objectAtIndex:i];
     NSString *datesss =[birthday objectAtIndex:i];
    NSString *query1 = [NSString stringWithFormat:@"INSERT INTO userdata (name,date) VALUES (\"%@\",\"%@\")",namesss,datesss];
    NSLog(@"query1:%@",query1);
    [[DBManager sharedDatabase]executeQuery:query1];
}
userdata = [[DBManager sharedDatabase]userdata:@"select * from userdata"];
NSLog(@"userdata...%@",userdata);
[userdata addObjectsFromArray:manualdata];
[tempSearchData removeAllObjects];
[tempSearchData addObjectsFromArray:userdata];
NSLog(@"tempSearchData..%@",tempSearchData);
[friendlist reloadData];

}

Manjit Singh
  • 238
  • 2
  • 10
0

From Facebook sdk version 2.0 onwards, they changing the response like that(getting the list of friends who are using my app).I think from a particular date onwards its behave like that.if u register a new app in developer site ,it may behave like that only.

Suhail kalathil
  • 2,673
  • 1
  • 13
  • 12