Ready to use xcodeproj to ease the pain from Phonegap + Facebook Plugin installation!

No more headaches. A simple package, including Phonegap with Phonegap Facebook Plugin, ready to be launched and executed with minimum configuration.

Download PhonegapBook xcodeproj

And follow these instructions:

0. Create your Facebook app on http://developers.facebook.com;

1. Edit App Secret in DevAppFB / iOs / FacebookConnectPlugin.m;

2. In <appname>-info.plist :

  • Replace com.fbplugintest.devapps with your bundle
  • Replace fb158422444250785 with fb[your-facebook-app-api-key].

3. In index.html look for:

FB.init({ appId: “158422444250785”, nativeInterface: PG.FB, scope: “publish_stream” })

And change appId.

That should be enough.

Let me know!

23. January 2012 by Francesco
Categories: iphone apps | Tags: , , , | 23 comments

Comments (23)

  1. Thanks so much for doing this!

    This works until you approve the Facebook permissions, but then it tries to redirect to http://m.facebook.com/dialog/oath?refid=0, resulting in a 404.

    Any thoughts?

    Also I’m showing facebook-ios-sdk.xcodeproj below my project in the left pane in Xcode. Is that the it’s supposed to be?

    • I think the problem could be your app secret and id. If you check out the index.html file in the demo, the app id is also on line 135. Let me know if correcting this solves the issue.

      As for the xcodeproj, it’s how it’s supposed to be.

  2. Hi,

    I start to use your Xcode project for phoneGap and Facebook Plugin. (great job 🙂 )
    I have already try to use phonegap plugin directly…

    And I am blocked at the same point, an alert in safari page, just after click on accept application… The alert say : Cannot Open Page , Safari cannot open the page because the address is invalid…

    I think, this error is due to my facebook apps configuration, but I don’t understand what is my problem.

    If you have an idea about this…

    Regards

    Loic

    PS : I’m french, sorry for my english….

    • I think the problem could be the same for the you and BigBobby: double check your app secret and id. If you check out the index.html file in the demo, the app id is also on line 135.

  3. I’m having the same issue. Your code compiles perfectly, but when I add my info it fails. I changed the App ID and the App Secret with no luck. Looking at the JS it appears you are using an older version of the code. Any chance you post an update? Thanks again for doing this, I’ve been banging my head against this stuff for a few days now, the documentation out there is pretty bad on plugins for Phonegap.

    Eric

    • And I solved my own question 🙂 It looks like there are three different places you need to change info, one in a .m file, one in the index.html file, and one as a .plist setting. If you miss one (and I did) it doesn’t work.

      Thanks for putting this out into the world!

      Eric

  4. This is great, many thanks. Couple questions:

    1) how could I have the user login within my app rather than having them go to Safari?

    2) how could I integrate this into an existing .xcodeproj? should I just add the Plugins/FBConnect, Plugins/ios, and facebook-ios-sdk-xcodeproj to my existing project?

  5. You are just impressive. You save me from so much pain.
    Thank you +++

  6. Any chance we’ll see an updated version of this? This is amazingly helpful but some of the SDK is a little old. Thanks for doing this for the community!

  7. Great work! Any chance you could get this working with the latest PhoneGap (i.e. 1.5/Cordova)? Thanks!!!

  8. I installed and followed the instructions. When I login, it opens up Sefari and after I login I get the message “Sefari cannot open the page because the address is invalid.” Does anyone know what the issue can be? Any help is greatly appriciated!

  9. I have a problem i have export de project in the zip but phonegap.frameworks is not included. Must i get the framework sonewhere else? or i must do something diferent in xcode?

  10. Any more thoughts on an updated version of this? It doesn’t look like anyone else has done this, and I find it a nightmare to install Phonegap plugins. Thanks again for posting this!

  11. Awaiting for plugin for latest Phonegap/ Thanks

  12. I’d love to hear when you update your package so cordova and xcode work well!

  13. This isn’t necessarily the update everyone’s looking for, but it does step you through installing the plugin. http://www.youtube.com/watch?v=hJZfqeXhEQM&list=FLJKoAN1b61wiIlHphX-Ur8Q&index=1&feature=plpp_video

  14. I am also getting the error Safari cannot open the page because the address is invalid… i done everything but nothing works