xcode 在 iPhone 中邀请 Facebook 好友

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16412168/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 03:20:59  来源:igfitidea点击:

Invite facebook friends in Iphone

iphoneiosobjective-cxcodefacebook

提问by user2357044

I want to integrate Facebook in my app. The functionality like this the user will login in to Facebook, then fetch the all friends & send the friend request for the app. I uses IOS6.

我想在我的应用程序中集成 Facebook。像这样的功能用户将登录到 Facebook,然后获取所有好友并发送应用程序的好友请求。我用的是IOS6。

So, is there any solution for this using Social framework?

那么,是否有任何使用社交框架的解决方案?

How can i do this?

我怎样才能做到这一点?

I get code from Here

我从这里得到代码

But getting error for account.

但是帐户出现错误。

回答by NMALKO

This:Facebook SDK for iOS and the iOS 6 Facebook Integration

这是:适用于 iOS 的 Facebook SDK 和 iOS 6 Facebook 集成

and this:How to easily integrate your iOS App with Facebook

和这个:如何轻松地将您的 iOS 应用程序与 Facebook 集成

UPDATE: App Request

更新:应用程序请求

You can easily send the app request very easily by Using Facebook SDK For Making App Request Please Make sure Following steps

通过使用 Facebook SDK 进行应用请求,您可以非常轻松地发送应用请求,请确保遵循以下步骤

1)Make sure you have added the latest Facebook SDK in Your Application Folder

1)确保您已在您的应用程序文件夹中添加了最新的 Facebook SDK

if not,you may download from this link https://github.com/facebook/facebook-ios-sdk

如果没有,您可以从此链接下载https://github.com/facebook/facebook-ios-sdk

Now you just need to Add FBConnect Folder in your Project Folder.

现在您只需要在您的项目文件夹中添加 FBConnect 文件夹。

2)Then Make sure you have Registered your iphone App as "App on Facebook" Type Select how your app integrates with Facebook under Basic App Settings.

2)然后确保您已将您的 iphone 应用程序注册为“Facebook 上的应用程序”类型在“基本应用程序设置”下选择您的应用程序如何与 Facebook 集成。

if not,you can do that here https://developers.facebook.com/apps/

如果没有,你可以在这里做https://developers.facebook.com/apps/

NSString *friendId=@"FacebookId Of Your Friends";

NSLog(@"%@",friendId);

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"Hi please add me as a friend.",  @"message",
                                   friendId, @"to",
                                   nil];
 [appDelegate.facebook dialog:@"apprequests" andParams:params  andDelegate:self];

Also, don't forget to adopt the FBdialogDelegate protocol first in your ViewController Class.

另外,不要忘记首先在您的 ViewController 类中采用 FBdialogDelegate 协议。

UPDATE2: Friend Request

UPDATE2:好友请求

Create a NSMutableDictionary to make a "appRequest" with their corresponding parameters but indicate that the type of dialogue is a "friends". It's a strange solution but it works.

创建一个 NSMutableDictionary 来创建一个带有相应参数的“appRequest”,但指出对话的类型是“朋友”。这是一个奇怪的解决方案,但它有效。

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];
}

Hope this helps you out. If so, please feel free to accept the answer.

希望这可以帮助你。如果是这样,请随时接受答案。

回答by Nishant Tyagi

You can check this over here :

你可以在这里检查:

send-requests-using-ios-sdk

使用 ios-sdk 发送请求

and
invites and requests


邀请和请求

Hope it helps you.

希望对你有帮助。