在sharekit中获取facebook和twitter的用户id

发布于 2024-10-13 19:39:21 字数 101 浏览 3 评论 0原文

我正在使用 iPhone 应用程序的 sharekit 实现 facebook 和 twitter。我们如何获取登录用户的用户 ID,以便我可以将其发送到服务器。任何帮助将不胜感激。谢谢。

Iam implementing facebook and twitter using sharekit for an iphone app. How can we get the user id of the logged in user so that I could send it to the server. Any help will be greatly appreciated. Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

荒人说梦 2024-10-20 19:39:21

您可以使用新的 facebook 图形 API 获取 facebook 用户信息作为示例代码,您可以使用 这个

you can get facebook user information using new facebook graph APIs for sample code you can use this.

不爱素颜 2024-10-20 19:39:21

您是否尝试过安装 Sharekit 的第 3 步?

<块引用>

第3步:填写API密钥

ShareKit 提供的大多数 Web 服务
集成要求您使用 API
连接时按键。 API 密钥是
唯一的标识符告诉
服务是什么应用程序正在制作
请求。

您必须注册每个 api 密钥,
但它们都是免费的并且注册是
快点。

找到并打开文件 SHKConfig.h,
就在您的 ShareKit 组内
项目的文件列表。

在顶部,您会找到一个列表
需要 api 密钥的服务。每个
服务旁边有一个链接。跟随
每个服务的链接以获得
API 密钥。填写每个API密钥
内对应的服务
SHKConfig.h。

注意:请遵循
SHKConfig 文件,他们提供
额外的步骤和可能的
每个服务的自定义。

有关完整文档,请参阅 http://www.getsharekit.com/install/http://www.getsharekit.com/docs/

Did you try Step 3 of the installation for Sharekit?

Step 3: Filling in API Keys

Most of the web services that ShareKit
integrates require you to use an API
key when connecting. An API key is a
unique identifer that tells the
service what app is making the
request.

You have to sign up for each api key,
but they are all free and sign-ups are
quick.

Locate and open the file SHKConfig.h,
just inside the ShareKit group in your
project's file list.

At the top you'll find a list of
services that require api keys. Each
service has a link next to it. Follow
the link for each service to get an
api key. Fill in the api key for each
corresponding service within
SHKConfig.h.

Note: Follow the comments within the
SHKConfig file, they provide
additional steps and possible
customizations for each service.

For the full documentation see http://www.getsharekit.com/install/ and http://www.getsharekit.com/docs/

国粹 2024-10-20 19:39:21

我不知道文本用户名,但如果您想要 id -

请查看 ShareKit 的 SHKFacebook 类。
它有一个名为 session 的 FBSession 成员。
FBSession 有一个 FBUID,它只是 long 的 typedef - 但我假设它代表某种形式的用户 ID。

I don't know about the textual user name, but if you are after the id -

Take a look at ShareKit's SHKFacebook class.
It has an FBSession member called session.
An FBSession has a FBUID which is just a typedef for long - but I'm assuming it represents some form of user ID.

橘虞初梦 2024-10-20 19:39:21

您可以通过扩展 sharetype 中的枚举来获取 ID。添加类型作为 ID 。并在可以共享功能时介绍一下身份检查的情况。

- (void)getFollowers
{
    OAMutableURLRequest *oRequest = [[OAMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=%@", SHKTwitterUsername]]
                                                                   consumer:consumer
                                                                      token:accessToken
                                                                      realm:nil   // our service provider doesn't specify a realm
                                                          signatureProvider:nil]; // use the default method, HMAC-SHA1

    [oRequest setHTTPMethod:@"GET"];

    //NSString *message=[NSString stringWithFormat:@"status=oh man! OAuth u almost killed me! more info at http://dev.twitter.com"];
    //[request setHTTPBody:[message dataUsingEncoding: NSUTF8StringEncoding]];

    OADataFetcher *fetcher = [[OADataFetcher alloc] init];
    //todo : handle for error callback
    [fetcher fetchDataWithRequest:oRequest
                         delegate:self
                didFinishSelector:@selector(getListsTokenTicket:didFinishWithData:)
                  didFailSelector:nil];

}

you can get the ID's by extending the enum in sharetype . add type as ID . and when you can share function introduce the case for ID checking .

- (void)getFollowers
{
    OAMutableURLRequest *oRequest = [[OAMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://api.twitter.com/1/followers/ids.json?cursor=-1&screen_name=%@", SHKTwitterUsername]]
                                                                   consumer:consumer
                                                                      token:accessToken
                                                                      realm:nil   // our service provider doesn't specify a realm
                                                          signatureProvider:nil]; // use the default method, HMAC-SHA1

    [oRequest setHTTPMethod:@"GET"];

    //NSString *message=[NSString stringWithFormat:@"status=oh man! OAuth u almost killed me! more info at http://dev.twitter.com"];
    //[request setHTTPBody:[message dataUsingEncoding: NSUTF8StringEncoding]];

    OADataFetcher *fetcher = [[OADataFetcher alloc] init];
    //todo : handle for error callback
    [fetcher fetchDataWithRequest:oRequest
                         delegate:self
                didFinishSelector:@selector(getListsTokenTicket:didFinishWithData:)
                  didFailSelector:nil];

}
痴情换悲伤 2024-10-20 19:39:21

如果您需要一些用户信息,用户名等,这个问题可以在 reborn ShareKit 中解决。请参阅常见问题解答

If you need some user info, user name etc, this problem is solved in reborn ShareKit. See FAQ.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文