xcode 使用 Facebook iOS SDK 2,我如何喜欢一个页面?- “应用程序必须在白名单中”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3809652/
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-14 19:47:28  来源:igfitidea点击:

using Facebook iOS SDK 2, how do I like a page? - "Application must be on whitelist"

iphonexcodefacebookoauth

提问by WoodenKitty

How do I "like" a page using the new Facebook iOS SDK? (http://github.com/facebook/facebook-ios-sdk)

如何使用新的 Facebook iOS SDK“点赞”页面?(http://github.com/facebook/facebook-ios-sdk)

I'm currently attempting to do it with:

我目前正在尝试这样做:

NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[_facebook accessToken],@"access_token",nil];
[_facebook requestWithGraphPath:@"cocacola/likes" andParams:dict andHttpMethod:@"POST" andDelegate:self];

This doesn't work. When I NSLog([error description]);I get:

这不起作用。当NSLog([error description]);我得到:

Error Domain=facebookErrDomain Code=10000 "The operation couldn't be completed. (facebookErrDomain error 10000.)" UserInfo=0x6a50160 {error=<CFBasicHash 0x6a4fd40 [0x250b380]>{type = mutable dict, count = 2,
entries =>
    2 : <CFString 0x6a4fc80 [0x250b380]>{contents = "type"} = <CFString 0x6a50000 [0x250b380]>{contents = "OAuthException"}
    3 : <CFString 0x6a500e0 [0x250b380]>{contents = "message"} = <CFString 0x6a50080 [0x250b380]>{contents = "(#3) Application must be on whitelist"}
}
}

I have added my IP (the IP address my computer, as I'm running from the simulator, gets when visiting www.whatismyip.com ) to the whitelist in my Facebook application's white list under advanced settings.

我已将我的 IP(我的计算机的 IP 地址,当我从模拟器运行时,在访问 www.whatismyip.com 时获取)添加到高级设置下我的 Facebook 应用程序白名单中的白名单。

Thanks!
Tristan

谢谢!
特里斯坦

采纳答案by Kris Markel

It looks like it's a well known, but unconfirmed, bug: http://bugs.developers.facebook.net/show_bug.cgi?id=10714.

看起来这是一个众所周知但未经证实的错误:http: //bugs.developers.facebook.net/show_bug.cgi?id=10714

It may help if you voted for the bug in Facebook's bug tracker.

如果您投票支持 Facebook 的错误跟踪器中的错误,这可能会有所帮助。

回答by Derek Pearcy

Partial solutions have been suggested, though the user experience is only great if the user is already logged in to FB -- this may be likely for many but not all users, so it remains an imperfect approach.

已经提出了部分解决方案,尽管只有当用户已经登录到 FB 时用户体验才会很好——这可能适用于许多但不是所有用户,因此它仍然是一种不完美的方法。

http://angelolloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html

http://angeloloqui.blogspot.com/2010/11/facebook-like-button-on-ios.html

回答by Arie Litovsky

1)Use the facebook iOS SDk to check if the user is logged in.
2)Once the user is logged in, load the facebook Like API into a webview.

See http://developers.facebook.com/docs/reference/plugins/like/#
You should load something like this (format with appropiate params where you see %@, %i):

http://www.facebook.com/plugins/like.php?href=%@&layout=%@&show_faces=%@&width=%i&action=%@&colorscheme=%@&font=%@"

1) 使用 facebook iOS SDk 检查用户是否登录。
2) 用户登录后,将 facebook Like API 加载到 webview 中。

请参阅http://developers.facebook.com/docs/reference/plugins/like/#
你应该加载这样的东西(格式与你看到 %@, %i 的适当参数):

http: //www.facebook.com /plugins/like.php?href=%@&layout=%@&show_faces=%@&width=%i&action=%@&colorscheme=%@&font=%@"

3)Profit.

3)利润。

Also, the reason the user won't have to login is because a cookie will be saved once they log in using the Facebook iOS SDK login screen (If you are doing it in your app and not Safari/FB app).

此外,用户不必登录的原因是因为一旦他们使用 Facebook iOS SDK 登录屏幕登录后,cookie 将被保存(如果您是在您的应用程序中而不是在 Safari/FB 应用程序中这样做)。

回答by K. Kie?kowicz

This is not a bug, it's broken by design. Using Facebook API you are only allowed to liking posts (by sending post request to https://graph.facebook.com/POST_ID/likes&auth_token=...), nothing else. Right now there is only one application which is allowed to liking pages using facebook api, it's "causes".

这不是错误,它被设计破坏了。使用 Facebook API,您只能喜欢帖子(通过将帖子请求发送到https://graph.facebook.com/POST_ID/likes&auth_token=...),仅此而已。现在只有一个应用程序可以使用 facebook api 点赞页面,它是“原因”。