如果朋友们的应用程序安装iOS版Facebook的检查 [英] iOS facebook check if friends have app installed
问题描述
有已经与Facebook的API的ios的方式来获得已经安装了谁是你的应用程序的好友列表?我基本上需要类似字与朋友,他们可以决定哪些你的FB朋友都在玩游戏什么的。我有一个解决方案,它需要一些额外的数据库使用但也许希望FB的API有一些内置该类型的查询。
Is there already a way with the facebook ios API to get a list of friends who have your app installed? I basically require something similar to "Words with Friends" where they can determine which of your FB friends are playing the game. I have one solution which requires some extra database use but was hoping maybe the FB api had something built in for this kind of query.
推荐答案
创建一个 FBFriendPickerDelegate
委托类并覆盖该功能:
Create a FBFriendPickerDelegate
delegate class and override this function:
-(BOOL)friendPickerViewController:(FBFriendPickerViewController *)friendPicker shouldIncludeUser:(id<FBGraphUser>)user{
BOOL installed = [user objectForKey:@"installed"] != nil;
return installed;
}
对于没有安装应用的用户,安装
字段将无
,但您有权要求当你加载数据:
For users that do not have your app installed, installed
field will be nil
, but you have to request it when you load data:
self.friendsController = [[FBFriendPickerViewController alloc] initWithNibName:nil bundle:nil];
//...
NSSet *fields = [NSSet setWithObjects:@"installed", nil];
self.friendPickerController.fieldsForRequest = fields;
//...
[self.friendsController loadData];
这篇关于如果朋友们的应用程序安装iOS版Facebook的检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!