- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我想选择一个 friend 并向他们发送使用我的应用程序的邀请。我使用 Graph API 的 invitable_friends
方法来获取尚未安装我的应用程序的好友列表。然后我在应用程序 UI 中呈现我的 friend 。用户选择 friend 并点击发送邀请。这就是问题所在。我尝试使用FBSDKAppInviteDialog
,但我无法在其内容中设置特定用户。并且选择 friend 的唯一可能是使用 facebook 对话框,而不是自定义 View 。
我尝试使用 FBSDKGameRequestDialog
。它的内容有一个属性to
来设置特定的用户,但是FBSDKGameRequestDialogDelegate
方法是不可达的。而且我不确定使用游戏请求是否是邀请 friend 使用我的应用程序的正确方式。
较旧的 Facebook SDK 提供了 [FBWebDialogs presentRequestsDialogModallyWithSession:message:title:parameters:handler:]
。这很好用。
最佳答案
我是这样使用的:
首先,您获取 FB 好友列表并将其存储在 NSMutableArray 中:
- (void) getFriendsFromFB:(NSDictionary*)parameters invitable:(BOOL) invitable {
NSString* graphPath = @"/me/friends";
if (invitable) {
graphPath = @"/me/invitable_friends";
}
FBSDKGraphRequest* request = [[FBSDKGraphRequest alloc] initWithGraphPath:graphPath parameters:parameters];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection * connection, id result, NSError *error){
if (error) {
NSLog(@"Facebook: error handling friend invite request at path %@: %@", graphPath, error.description);
}else{
NSLog(@"Facebook: successfully handled friend request for graph path %@",graphPath);
NSArray *friendArray = [result objectForKey:@"data"];
for (NSDictionary* friendDict in friendArray) {
FContact* contact = [[FContact alloc] initWithFaceBookID:friendDict[@"id"] name:friendDict[@"name"] avatarURL:friendDict[@"picture"][@"data"][@"url"]];
contact.hasMyGameInstalled = !invitable;
[[FStorage sharedInstance].friends addObject:contact];
}
NSLog(@"Facebook contacts received: %lu contacts",(unsigned long)friendArray.count);
if (!invitable) {
NSLog(@"Facebook: making game");
storage.currentGame = [[FGame alloc] initWithPreset];
[storage.savedGames addObject:storage.currentGame];
[[NSNotificationCenter defaultCenter] postNotificationName:@"GameInfoUpdated" object:nil];
}
}
}];
}
现在,我可以显示 FB 好友列表,让用户选择邀请谁。当我选择了用户后,我会向他推荐一款游戏:
- (void) proposeGameTo:(FContact*) contact{
FBSDKGameRequestContent *gameRequestContent = [[FBSDKGameRequestContent alloc] init];
// Look at FBSDKGameRequestContent for futher optional properties
gameRequestContent.message = @"Let's play My brilliant game together";
gameRequestContent.title = @"My custom invitation";
gameRequestContent.to = @[contact.facebookID];
gameRequestContent.actionType = FBSDKGameRequestActionTypeTurn;
FBSDKGameRequestDialog* dialog = [[FBSDKGameRequestDialog alloc] init];
dialog.frictionlessRequestsEnabled = YES;
dialog.content = gameRequestContent;
dialog.delegate = self;
// Assuming self implements <FBSDKGameRequestDialogDelegate>
[dialog show];
}
关于ios - Facebook 开发工具包。邀请 friend 使用该应用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29495641/
我想知道将来对我来说最简单的方法是什么,可以使查询既有效又不那么复杂。 我应该像这样保存双向关系吗 from_id=1, to_id=2from_id=2, to_id=1 或者只创建一个唯一的行 f
假设您有一个拥有十亿用户的社交网络。在每个用户的页面上,您想要显示该用户的 friend 数、 friend 的 friend 等等,最多五度。友谊是相互的。计数不需要立即更新,但它们应该是精确的。
public void notMyFriend(Student student1) { System.out.println("Friends who are not my frien
我有如下3个表格 用户 - id integer primary_key - user_name friend - id autoincrement primary_key - user1 integ
如何从 Friends 表中获取 friend 列表以及我 friend 的 friend 数(不包括我的 friend 数) friend 表"tbl_users_friends 字段 1:id字段
我的 MySQL 表结构是这样的。 USER int id varchar username FRIEND_LIST int user_id int friend_id 对于每个 friend 关系,
假设 a,b,c 和 b,d,e 和 c,f,g 和 a,e,g,h 是 friend 。所以 获取共同好友 b/w a&b: MATCH (me:User {username:'a'}) -[r:F
我正在开发“可能的 friend ”功能。我需要显示所有不是我 friend 的 friend 的 friend ,也不要发送我或没有我的待处理请求 FRIENDSHIPS user_id frien
如果两个用户是 friend ,我在“ friend ”表中有一个条目,如下所示: table: friends ------------------------ uid1
我有一个 friend 表,用于跟踪数据库中的关系 - 我将一个查询与子查询放在一起,该子查询从 friend 的 friend 那里获取个人资料信息 我的 friend 表如下所示 - id 双向出
我想结交 friend 的 friend 的 friend 。我得到了结果,但我不确定我的查询是否正确。我正在使用嵌套选择。 我的问题是: 查询是否正确? 我如何使用 join 执行此查询? 这是我的
假设我有一个包含 friend 属性的用户对象。这个 friends 属性是其他用户对象的数组,因此是你的 friend 。找到你 friend 的 friend 但不是你 friend 的最快算法是
我想结交我的 friend 以及 friend 的 friend ,但仅限于二级 friend 我的表结构是这样的 user_id friend_user_id 1 2 1
为了了解使用 Neo4J 建立 friend 关系的优势,我在 MySQL 数据库上创建了一张用于 Persons 的表(“Persons”,20900 个数据集): id | name --
假设我有一个名为“ friend ”的表,对于每个友谊,我添加两个条目。例如,如果用户 1 和 2 是 friend ,我们将有: uid1 uid2 ---------- 1 2 2 1
在我的图形数据库中,我有 Twig 和树叶。分支可以“包含”叶子,分支可以“包含”分支。 如何使用 Gremlin 找到与给定分支直接或间接相关的所有叶子? 我让这个在 Cypher 中工作: STA
我正在尝试使用 iPhone Facebook SDK 获取我 friend 的 friend 列表。我尝试了一种使用 FQL 和 Graph API 的方法,但在这两种情况下我都遇到了错误: "Ca
我有这个 MySQL 表: 假设我以用户 1 的身份登录,正在浏览用户 2 的个人资料。由于我们是共同的 friend (1 是 2 的 friend ,2 是 1 的 friend ),我需要回应“
我想得到我 friend 的 friend 不是我 friend 的 friend 。我有一张这样的 table :用户 friend (idUser,idUserFriend) 我在想这样的事情:
我有这个 Cypher 查询... match (p:Person{userid:8432})-[r:friends_with]->(p1:Person)-[r2:friends_with]->(p2
我是一名优秀的程序员,十分优秀!