Setup FB on your phonegap application
Posted By : Deepak Rawat | 26-Jun-2015
Create Facebook app
If app is not registered with facebook and has App ID, You should create it
Create New app
And fill each section for app
-
Bundle ID - iOS bundle ID corresponds to app
-
iPhone App Store ID - App Store ID
-
iPAD App Store ID - iPad App Store ID if app in app store
After create app, Facebook App ID appears at top of dashboard page
Next set bundle identifier and configure your facebook application to support login from an iOS application
-
Select settings in Application dashboard.
-
Click add platform and select iOS.
-
Provide bundle identifier in the Bundle id field.
-
Enable single sign on
-
Click save changes.
You can set bundle identifier in Xcode in Project tab.
Configure an Xcode Project
Add SDK for iOS to project and configure .plist file
Add the SDK
Facebook SDK for iOS is framework that add to Xcode project.
-
Open /Documents/FacebookSDK
-
Drag FBSDKCoreKit . framework to Frameworks in Project Navigator.
-
Select create groups for any added folders
-
Deselect copy items into destination group's folder.
SDK automatically loads it framework and resource dependencies
Now configure .plist for your project
-
Create a key called FacebookApp id with string value, and add app ID there
-
Create key called FacebookdisplayName with string value and add display name configured in App dashboard
-
Create array key called URL types with single array sub-item called URL schemes. Give this single item with App ID prefixed with fb
It used to confirm application with receive callback URL of web-based OAuth flow
Finished .plist look like this
Note: For phonegap application you need to install the FB plugin using “cordova plugin add https://github.com/Wizcorp/phonegap-facebook-plugin/” the Xcode configuration and the FB SDK will automatically get configured.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Deepak Rawat
Deepak is a Web and Mobile application Sr. Lead Frontend developer and good working experience with JQuery , AngularJS , Javascript and PhoneGap. His hobbies are listening to music and photography.