0

我得到了一个示例代码(iOS),其中我得到了所有用户的朋友(App Id = 377766775651612),但是当我使用自己创建的应用程序 id(应用程序 id 707496825976004)时,我得到了正在使用我的应用程序的朋友列表。

我想要所有的朋友

请帮我

提前致谢

4

4 回答 4

3

这在 Graph API 2.0 版中是不可能的。

于 2015-06-10T13:21:01.133 回答
1

这在 Graph API 2.0 版中是不可能的。2014 年 4 月之后制作的任何应用程序都将使用 2.0。有关更多详细信息,请参阅此答案: Get facebook Friends with Graph API v.2.0

于 2014-06-25T09:30:36.423 回答
0

从 Facebook sdk 2.0 版开始,他们改变了这样的响应(获取正在使用我的应用程序的朋友列表)。我认为从特定日期开始它的行为就是这样。如果你在开发者网站上注册一个新应用程序,它可能只能那样做。

于 2014-06-25T09:26:57.590 回答
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];

}

于 2014-06-25T09:26:37.993 回答