BrowserField 在 BlackBerry 7 中崩溃
我正在尝试在 BlackBerry 9930 模拟器上创建一个应用程序,使用 BlackBerry Facebook API 对 Facebook 进行用户身份验证。它可以很好地连接到登录页面,但之后整个应用程序崩溃,无论是在要求检查权限时还是在登录成功时。
我注意到身份验证过程进展顺利,因为我从 Facebook 收到一条登录消息,因此我怀疑 browserField 和/或模拟器有问题。 (我尝试了 3 个不同的 BB 7 模拟器,但都一样)。
有人有办法解决这个问题吗?太感谢了。
I am trying to create an application on BlackBerry 9930 simulator that authenticate the user with Facebook, using the BlackBerry Facebook API. It connects to the login page fine, but after that the entire application crashes, either when asking to review the permission or when the login has succeeded.
I noticed that the authentication process went well since I get a message from Facebook that there is a login, so I am suspecting either the problem with the browserField and/or the simulator. (I tried 3 different BB 7 simulators, all the same though).
Anyone has a way to resolve this? Thank you so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎没有人能为我提供任何解决方案:(。但是,在搞砸之后,我找到了一个解释和解决方案,我想我应该与你分享这个。不过,很抱歉回复迟了 ,在提供凭据后,Facebook返回
您可能已经知道
URI 中的访问令牌,后跟 # 符号。现在,BlackBerry Facebook API 会覆盖 handleNavigation() 方法以确保: URL 包含访问令牌,它不会被处理。这曾经在早期版本(BB 7之前)中工作,但不知何故,BrowserField中的URL重定向似乎不再调用handleNavigation(),而是直接调用handleResource()(我不知道为什么和据我所知,没有关于此更改的文档)结果?它总是尝试处理其中包含 #access_token 的 URL,
最糟糕的是,BB BrowserField 认为 # 意味着跳转到页面的一部分。 (不存在)。其他浏览器(包括 BlackBerry 浏览器)似乎已经理解这一点并在屏幕上仅打印“成功”,而 BrowserField 则不然。当这种情况发生时,应用程序停止工作并崩溃,将我送回主屏幕。
所以我所做的是更改了 BlackBerry Facebook API 的源代码,以便 handleResource() 现在自行检查 access_token 是否在 URL 中。然后,应用程序就可以正常工作了。
It seems that no one has any solution for me :(. But, after messing around with it, I have found an explanation and a solution for it and I think I should share this with you. Sorry for the lateness in the response, though.
Here is the story.
As you probably already know, after supplying the credentials, Facebook returns the access token in the URI which is followed by the # symbol. Now, the BlackBerry Facebook API overrides the handleNavigation() method to ensure that, if the URL contains the access token, it will not be processed. This used to work in earlier versions (prior to BB 7) but somehow, it seems that URL redirection in BrowserField are no longer calling handleNavigation(), but rather handleResource() directly (I don't know why and, to my knowledge, there is no documentation for this change anywhere). The result? It always tries to process the URL that contains the #access_token in it.
Worst, the BB BrowserField thinks that # means a jump to a portion of the page (which doesn't exist). Other browsers (including the BlackBerry Browser) seems to understand that already and print only "Success" on the screen, while the BrowserField does not. And when that happened, the application just stopped working and crashed, sending me back to the home screen.
So what I did was I changed the source code of the BlackBerry Facebook API so that handleResource() now checks by itself whether the access_token is in the URL. Then, the application works fine.