Facebook iOS SDK - 写入状态时出现奇怪的效果

发布于 2024-12-12 05:04:53 字数 1096 浏览 0 评论 0原文

我正在更新我的应用程序以使用 xCode 4、iOS5 和最新的 Facebook SDK。之前一切都工作正常。

现在,发生了两件奇怪的事情,尽管检查了所有代码并搜索了论坛,但我不明白为什么。

请参阅下面的更新

首次登录

当用户刚刚登录时,如果他们共享状态或取消尝试这样做,则会显示一个脚本,如下所示:

<script type="text/javascript"> window.location.href="fbconnect:\/\/ success#_=_";
</script>

所有其他功能(例如,当这不是第一次)似乎工作正常。

我怀疑这与回调未触发有关,但我已经仔细检查了所有委托设置等。所有 facebook 委托方法都在 appDelegate 中,然后从视图控制器引用。

还有其他人遇到过这个问题吗?任何指示都将受到热烈欢迎。我还没有发布任何代码,因为我不确定要关注哪一点,而且我已经使用了 Facebook 开发者网站上的所有标准代码。

非常感谢,

克里斯。

更新

感谢@Kristofer Sommestad 和@Senior 的帮助。我有很多问题。

不要授权两次

Feed 对话框请求也会请求授权,因此不要同时请求两者。

更新了 SDK

在我发现问题后,SDK 已更新 - 因此请继续检查。

我没有意识到使用 SDK 代码所需的代码已经更改,特别是调用提要对话框的代码。查看 https://developers.facebook.com/docs/reference/dialogs/feed/

注销意味着什么

注销只是将用户从您的应用程序中注销,而不是从 Facebook 中注销。

I'm updating my app to use xCode 4, iOS5 and the latest Facebook SDK. All was working fine before.

Now, two strange things are happening and despite reviewing all the code and searching the forums, I can't see why.

See update below.

Logging in for first time

When the user has just logged in, if they either share the status or cancel the attempt to do so, a script is displayed as follows:

<script type="text/javascript"> window.location.href="fbconnect:\/\/ success#_=_";
</script>

All other functionality (e..g when its not the first time) seems to work fine.

I suspect this is something to do with call backs not firing, but I've double checked all the delegate setting etc. All the facebook delegate methods are in the appDelegate and then referred to from the view controller.

Has anyone else had this issue? Any pointers would be warmly welcomed. I haven't posted any code yet as I'm not sure which bit to focus on and I've used all the standard code from the facebook developer site.

Many thanks,

Chris.

UPDATE

Thanks to @Kristofer Sommestad and @Senior for their help. I had a number of issues.

Don't Authorise Twice

The feed dialog request also requests an authorisation, so don't request them both at the same time.

Updated SDK

The SDK was updated after I found my issues - so keep checking.

What I hadn't realised was that the required code to use the SDK code had changed, specifically the code to call the feed dialog. Check out https://developers.facebook.com/docs/reference/dialogs/feed/.

What Logout Means

Logging out just logs the user out of your App, not out of facebook.

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

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

发布评论

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

评论(3

花开半夏魅人心 2024-12-19 05:04:53

我也遇到了第一个问题,但通过确保身份验证不会触发两次来解决它。最初,我做了以下操作:

[_facebook authorize:permissions];
[_facebook dialog:@"feed" andParams:params andDelegate:self];

不确定这是你的问题,但我注意到这把事情搞砸了,因为它实际上触发了 2 个身份验证对话框,其中第二个对话框最终显示了你也看到的 Javascript 输出。
出于某种原因,我认为如果 authorize 已经这样做了,第二个就不会触发对话框......

相反,我确保首先 authorize: ,但在使用 -fbDidLogin 完成授权之前不会触发 dialog:andParams:andDelegate(并将对话数据保存为实例变量以共享)。

还没有看到仍然能够发布消息的任何问题,但也许它与第一个问题以某种方式相关(?)。

希望这也能帮助你。

I also experienced the first issue, but solved it by making sure authentication wasn't triggered twice. Initially, I had done the following:

[_facebook authorize:permissions];
[_facebook dialog:@"feed" andParams:params andDelegate:self];

Not sure this is your problem, but I noticed that this messed things up as it actually triggered 2 authentication dialogs, where the second one ended up with the Javascript output you're also seeing.
For some reason I had figured that the second one wouldn't trigger a dialog if authorize already had done so....

Instead, I made sure to authorize: first, but not trigger the dialog:andParams:andDelegate until the authorization was completed with -fbDidLogin (and saving the dialog data to share as an instance variable).

Haven't seen any issues with still being able to post messages, but maybe it's related to the first issue somehow (?).

Hope this helps you out too.

豆芽 2024-12-19 05:04:53

好的,我刚刚从 GitHub 存储库中进行了拉取,并且不再收到此错误。但是,它正在调用 (void)dialog:(FBDialog*)dialog didFailWithError:(NSError *)error

尝试更新到最新版本的 SDK,然后重试。

Okay, I just did a pull from the GitHub repository, and I'm not getting this error anymore. It is, however, calling (void)dialog:(FBDialog*)dialog didFailWithError:(NSError *)error

Try updating to the latest version of the SDK and trying again.

王权女流氓 2024-12-19 05:04:53

这个不需要的 javascript-view 也困扰着我。
我只使用 facebook feed 对话框 [facebook 对话框: @"feed" andParams: myParameters andDelegate: ptrMyDialogDelegate];。如https://developers.facebook.com/docs/reference/dialogs/feed所示/。我在其他地方没有进行任何其他授权。
委托是我的 AppModel 类(不是 AppDelegate)。 FBDialogDelegate 协议的所有方法都被正确调用,但之后我关闭了这个烦人的视图。

我没有使用GIT。我下载了 ZIP 文件并从 src/ 目录(包括 src/ JSON/ subdir) 和 FBDialog.bundle (总共 23 个文件)到我现有的项目中。

如果我下载 ZIP 文件或克隆 Facebook iOS SDK GIT 存储库,有什么区别吗?

要将 Facebook 类集成到我现有的 MyApp 项目中(意味着 MyApp 类树,如 Xcode 项目导航器中所示),我必须以相同的方式复制(例如拖放或 Xcode“广告文件 ...”)Facebook 类,不是吗?

This unwanted javascript-view bothers me too.
I just use the facebook feed dialog [facebook dialog: @"feed" andParams: myParameters andDelegate: ptrMyDialogDelegate];. Like shown at https://developers.facebook.com/docs/reference/dialogs/feed/. I do no other authorization anywhere else.
The Delegate is my AppModel-Class (not the AppDelegate). All methods of the FBDialogDelegate-Protocol are called correctly but after I close this annoying view.

I didn't use GIT. I downloaded the ZIP-File and copied all source files *.[h|m] from src/ directory (including src/JSON/ subdir) and the FBDialog.bundle (23 files in total) into my existing project.

Does it make any difference if I download the ZIP-File or clone the Facebook iOS SDK GIT-Repository?

To integrate the Facebook classes into my existing MyApp-project (means MyApp class tree like shown in Xcode Project Navigator) I do have to copy (e.g. drag'n drop or Xcode "Ad Files ...") the Facebook classes the same way, don't I?

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