使用FBConnect连接/发布到Facebook在模拟器上工作,但不是iPhone [英] Connecting/Publishing to Facebook with FBConnect Works on Simulator, but not iPhone

查看:281
本文介绍了使用FBConnect连接/发布到Facebook在模拟器上工作,但不是iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的iPhone应用程序中实现了FBConnect,它在模拟器(v4.3)上完美地工作。但是,当我在iPhone(v4.3.3)上测试相同的代码时,似乎我的Facebook按钮现在退出我的应用程序并打开了Facebook应用程序。 Facebook应用程序显示一个说明我已经授权我的应用程序的页面,并且我应该按Okay继续。起初我不认为这一定是一个问题的指示,但是当我按下Okay按钮时,我只是简单地返回到我的appViewController,我在开始时点击了我的Facebook按钮。



我的预期是什么,在我的模拟器中正确发生的是,点击Facebook按钮后,我的应用程序视图中会出现一个较小的Facebook子视图窗口,我可以选择发布到我的Facebook墙。我应该提到,我已经成功地在iPhone上运行了DemoApp(facebook-ios-sdk测试程序)。此外,我的应用程序不会崩溃,并且在我的调试器控制台窗口中没有报告错误。



为什么在我的iPhone上运行应用程序时遇到这样不同的结果?有没有人遇到类似的问题?我可以做些什么来解决?



提前感谢
Jeremy

解决方案您是否看过 https:验证和授权部分//github.com/facebook/facebook-ios-sdk



模拟器和您的设备之间的区别在于您的设备已安装了Facebook应用程序。如果您没有安装该应用程序,我猜测它可以正常工作,因为授权回调在应用程序内直接处理。但是,在安装了Facebook应用程序后,用户认证您的应用后,Facebook应用程序会使用URL处理程序将其重定向到您的应用程序。



您的工作是实现通过设置您的plist属性(您的应用程序在Facebook应用程序授权您之后重新启动,您似乎已经完成),并正确响应 - (BOOL)应用程序的正确URL处理代码:( UIApplication *)application handleOpenURL:(NSURL *)url app delegate message。要正确执行此启动程序的详细信息应列在上面的链接中。


I have implemented FBConnect into my iPhone App, and it works perfectly on the Simulator (v4.3). However, when I test the the same code on my iPhone (v4.3.3), it appears as though my Facebook Button now exits out of my application and opens the Facebook App. The Facebook App displays a page saying I have already authorized my app, and that I should press "Okay" to continue. At first I did not think this was necessarily indicative of a problem, but when I hit the Okay button, I am simply returned to my appViewController where I clicked on my Facebook Button in the beginning.

What I expected, and what occurs correctly in my simulator, is that a smaller Facebook subview window would appear in my application view after clicking the Facebook Button, and I would be given the option to publish to my Facebook Wall.

I should mention, that I have successfully been able to run the "DemoApp" (facebook-ios-sdk test program) on my iPhone. Also, my app does not crash and no errors are reported in my debugger console window.

Why am I experiencing such different results when running the application on my iPhone? Has anyone else experienced a similar problem? What can I do to fix it?

Thanks in advance, Jeremy

解决方案

Have you had a look at the "Authentication and Authorization" section at https://github.com/facebook/facebook-ios-sdk?

The difference between the simulator and your device is that your device has the Facebook app installed. If you didn't have the app installed, I'm guessing it would work perfectly because the authorization callbacks are handled directly within the app. However, with the Facebook app installed, after the user authenticates your app, the Facebook app "redirects" to your app using a URL handler.

It is your job to implement the correct URL handling code by setting up your plist property (which you appear to have done since your app relaunches after the Facebook app authorizes you), and also to respond correctly to the - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url app delegate message. The details to implement this launch handler correctly should be listed in the link above.

这篇关于使用FBConnect连接/发布到Facebook在模拟器上工作,但不是iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆