Can Facebook JS SDK work with Phonegap / Cordova?

扶醉桌前 提交于 2020-01-03 07:21:10

问题


I have Senscha 2.0 mobile application which I want to build using latest phonegap (cordova).

I want to add facebook login functionality. I found three options:

  1. Use ChildBrowser approach
  2. Use InAppBrowser.
  3. Use cordova facebook plugin

I decided to go with the second one.

I have problem with domain in FB app settings (Mobile Site URL).

I typed one of my domains there, but when building app using Cordova in xCode, facebook response with an error, because obviously phonegap / cordova doesn't "use" any domain.

When I uploaded my app (without using phonegap) to domain which I typed in Facebook settings, everything works on my iPhone (using as website in Safari).


To be more precise.

Facebook JS SDK works when I'm using my application as "mobile web application".

When I build my project using Cordova / Phonegap (it automatically uses InAppBrowser plugin), it stops working.

Will Facebook JS SDK work with Phonegap / Cordova?


回答1:


It can. Use OpenFB or Facebook Connect Phonegap Plugin.

Reference

OpenFb

  • http://coenraets.org/blog/2014/04/facebook-phonegap-cordova-without-plugin/
  • https://github.com/ccoenraets/OpenFB

Facebook Connect Phonegap Plugin

  • https://github.com/Wizcorp/phonegap-facebook-plugin


来源:https://stackoverflow.com/questions/15288177/can-facebook-js-sdk-work-with-phonegap-cordova

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!