【问题标题】:How to access the user's facebook account? OSX Mountain Lion如何访问用户的 Facebook 帐户? OSX 山狮
【发布时间】:2012-11-07 05:09:50
【问题描述】:

我正在使用来自 WWDC 的代码来访问用户的 Facebook 帐户:

self.accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [self.accountStore
                                      accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
[self.accountStore requestAccessToAccountsWithType:facebookAccountType
                             withCompletionHandler:^(BOOL granted, NSError *e) {
                                 if (granted) {
                                     NSArray *accounts = [self.accountStore
                                                          accountsWithAccountType:facebookAccountType];
                                     self.facebookAccount = [accounts lastObject];
                                 } else {
                                     // Fail gracefully...
                                 }
                             }];

但它在requestAccessToAccountsWithType:withCompletionHandler: 上给了我错误。

如何访问用户的 Facebook 帐户?

【问题讨论】:

    标签: objective-c facebook macos cocoa acaccount


    【解决方案1】:

    Facebook 支持仅在 10.8.2 中添加。你还在用 10.8.2 吗?如果是这样,你得到了什么具体的错误代码?我们不是读心术的人。


    如果您阅读标题,您会看到-requestAccessToAccountsWithType:withCompletionHandler: 在 Mac 上不存在,并且在 iOS 上已弃用。你应该使用-requestAccessToAccountsWithType:options:completion:

    【讨论】:

    • @PedroVieira:查看我的更新答案。该方法不存在。
    • @PedroVieira:阅读文档。
    猜你喜欢
    • 1970-01-01
    • 2012-08-09
    • 1970-01-01
    • 2016-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-15
    • 2013-10-04
    相关资源
    最近更新 更多