[英]How to make a friend request with facebook ios sdk?
i'm using the facebook iOS sdk. 我正在使用facebook iOS sdk。 I need to send friend requests between users of facebook, from an iOS app.
我需要在iOS应用程序之间发送Facebook用户之间的朋友请求。 I know that can not be sent via graph API.
我知道无法通过图形API发送。 I'm trying to through dialog of facebook i do not know how.
我正试图通过facebook的对话我不知道怎么做。 Can anyone help me?
谁能帮我?
This is my code: 这是我的代码:
Facebook *face = [[Facebook alloc] initWithAppId:@"APP_ID" andDelegate:self];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"user_id", @"id",
nil];
[face dialog:@"me/friends"
andParams:params
andDelegate:self];
With this code i get a dialog with this text: "The page you requested was not found" 使用此代码,我会看到一个包含此文本的对话框:“找不到您请求的页面”
Ok I found a solution. 好的,我找到了解决方案。 I have created a NSMutableDictionary to make a "appRequest" with their corresponding parameters but finally indicated that the type of dialogue is a "friends".
我创建了一个NSMutableDictionary来创建一个带有相应参数的“appRequest”,但最后表明对话的类型是“朋友”。 It's a strange solution but it works.
这是一个奇怪的解决方案,但它的工作原理。
Facebook *face = [[Facebook alloc] initWithAppId:FBSession.activeSession.appID andDelegate:nil];
face.accessToken = FBSession.activeSession.accessToken;
face.expirationDate = FBSession.activeSession.expirationDate;
if ([face isSessionValid]){
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"My Title", @"title",
@"Come check out my app.", @"message",
userId, @"id",
nil];
[face dialog:@"friends"
andParams:[params mutableCopy]
andDelegate:nil];
}
This may help you 这可能对你有所帮助
NSDictionary* params = [NSDictionary dictionaryWithObjectsAndKeys: message, @"message", title, @"title", nil];
[[self facebook] dialog: @"apprequests"
andParams: [params mutableCopy]
andDelegate: delegate];
See this question for further details and also this document. 有关详细信息,请参阅此问题以及本文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.