Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何从Facebook获取使用我的应用程序的好友列表_Iphone_Objective C_Facebook - Fatal编程技术网

Iphone 如何从Facebook获取使用我的应用程序的好友列表

Iphone 如何从Facebook获取使用我的应用程序的好友列表,iphone,objective-c,facebook,Iphone,Objective C,Facebook,我有一个要求,比如需要找到使用我的应用程序的朋友。与Instagram应用程序“从Facebook查找朋友”相同 我知道这是提供好友列表的代码 - (void) getFriendName :(id) sender { self.modeString = @"friendName"; NSString * query = [NSString stringWithFormat:@"SELECT name FROM user WHERE uid IN (SELEC

我有一个要求,比如需要找到使用我的应用程序的朋友。与Instagram应用程序“从Facebook查找朋友”相同

我知道这是提供好友列表的代码

- (void) getFriendName :(id) sender {

        self.modeString = @"friendName";

        NSString * query = [NSString stringWithFormat:@"SELECT name FROM user WHERE uid IN (SELECT uid1 FROM friend WHERE uid2=me())",appDelegate.friendList];
        NSLog(@"query :%@",query);
    //    NSString * query = [NSString stringWithFormat:@"SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND strlen(birthday_date) != 0 ORDER BY birthday_date",appDelegate.friendList];
        NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                        query, @"query",
                                        nil];
        [_facebook requestWithMethodName:@"fql.query"
                               andParams:params
                           andHttpMethod:@"POST"
                             andDelegate:self];
    } 

在这些好友列表中,如何使用我的应用程序仅检索好友?

如果您在服务器上维护数据,请在服务器端进行Facebook集成。

以下是我一直使用的查询

    NSString *isAppUser = usesApp ? @"1" : @"0";
NSString *query = [NSString stringWithFormat:@"SELECT uid FROM user WHERE is_app_user = %@ AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) LIMIT %d",
                   isAppUser, limit];
FBRequest *request = [FBRequest requestWithGraphPath:@"/fql" parameters:@{@"q":query} HTTPMethod:@"GET"];

您可以取消限制,让iApp用户始终保持@“1”

谢谢您的帮助……如果您详细说明您的答案,我可能会很不理解。在服务器端进行facebook集成。服务器将维护此应用程序每个用户的facebook id。应用程序将用户的FBU id发送到服务器。服务器将获取该用户的所有好友。如果您的服务器数据库中存在您朋友的fb_id,则表示您的朋友正在使用相同的应用程序。Like wise server将为您的所有朋友检查此项,并为您提供使用相同应用程序的facebook朋友列表