iOS集成facebook SDK官方文档
来源:互联网 发布:史记哪个版本好 知乎 编辑:程序博客网 时间:2024/04/30 06:32
Getting Started with the Facebook iOS SDK
?
This guide covers what you need to go through in order to be able to start using the Facebook SDK for iOS, in five easy steps:
- Step 1: Prerequisites
- Step 2: Install the Facebook SDK for iOS
- Step 3: Obtain a Facebook App ID
- Step 4: Configure your Xcode Project
- Step 5: Start coding!
Looking for more information about the Facebook Audience Network? Try our Getting Started Guide for Audience Network.
Step 1: Prerequisites
- OS X is required for all iOS development.
- You need Xcode. If you don't have it, you can get it from the App Store.
- Optionally, you may want to use Git.
The Facebook SDK for iOS versions 3.17+ supports iOS 6.x and higher. Support for iOS 5.x was dropped in version 3.17 of the SDK.
Step 2: Install the Facebook SDK for iOS
Download the SDK and install the package by following the instruction wizard. The default install location is ~/Documents/FacebookSDK
.
The SDK is also available on GitHub (CocoaPods supported).
Step 3: Obtain a Facebook App ID
If you haven't already registered your app with Facebook by creating a Facebook app, you should create a new app:
Create a New App
And fill in the information:
Once your app is created, or if you already had a Facebook app, the app ID is shown at the top of the dashboard page.
If you already have a Facebook app (and corresponding Facebook app ID) that you're usingfor the same app in another platform (for example, Android), you can use the same app ID for iOS.
Next, you need to set the Bundle Identifier and configure your Facebook application to support login from an iOS application.
Select "Settings" from the left-hand nav. Inside the settings, click on "Add Platform" and choose "iOS". Then provide your Bundle Identifier in the "Bundle ID" field and enable "Single Sign On". Don't forget to save the changes!
You can find or set your Bundle Identifier in Xcode in the Project tab.
Step 4: Configure your Xcode Project
Add the Facebook SDK for iOS to your project and configure your .plist file.
Add the Facebook SDK
The Facebook SDK for iOS is a framework that you add to your Xcode project. To add the SDK, open~/Documents/FacebookSDK
and drag the FacebookSDK.framework
folder into the Frameworks section of your Project Navigator.
Choose 'Create groups for any added folders' and deselect 'Copy items into destination group's folder (if needed)' to reference the SDK where it was installed rather than copying the SDK into your app.
The SDK will automatically load its framework and resource dependencies.
Configure the .plist
Follow these three steps:
- Create a key called
FacebookAppID
with a string value, and add the app ID there. - Create a key called
FacebookDisplayName
with a string value, and add the Display Name you configured in the App Dashboard. - Create an array key called
URL types
with a single array sub-item calledURL Schemes
. Give this a single item with your app ID prefixed withfb
. This is used to ensure the application will receive the callback URL of the web-based OAuth flow.
The finished .plist
should look something like this:
Optionally, if you want all the SDK classes to work "out of the box" you may want to also add the -ObjC linker flag to your project. However, if you choose to do this you will be increasing the size of your executable (due to additional SDK object code loaded into your application). You can learn more about this trade off, what exactly the -ObjC flag does, and how to set it in our troubleshooting guide.
Step 5: Start coding!
The SDK is now installed and set up. You can use the SDK from any of your implementation files by adding the Facebook SDK header file:
#import <FacebookSDK/FacebookSDK.h>
If you want something more complete you can look at one of our feature-based tutorials. These tutorials will walk you through feature implementation and, if relevant, provide sample code and point you to sample apps where you can see the feature in action:
- Sharing
- Login with Facebook
- App Events
- Making Graph API calls
- Tell a story with Open Graph
- Built-in dialogs and UI controls
If you're a games developer we suggest you check out Friend Smash, our game sample. Friend Smash shows to use the Facebook SDK for iOS to make your game more social.
We also have other samples, shipped with the Facebook SDK for iOS or on GitHub. Each demonstrates an important features and techniques for building social apps. You can find a list of all the sample appshere.
- iOS集成facebook SDK官方文档
- facebook login官方文档iOS
- Facebook官方sdk对接
- iOS短信验证码SDK集成文档
- iOS短信验证码SDK集成文档
- Android Studio集成Facebook SDK
- facebook SDK ios 接入
- android 官方SDK文档
- Facebook iOS SDK(Facebook API类库)
- Google、FaceBook官方登录SDK思路
- Facebook SDK(iOS)初学讲解
- IOS 植入Facebook SDK --- 分享
- Facebook SDK(iOS)初学讲解
- iphone项目中集成facebook SDK
- Android Studio集成Facebook SDK Sample
- Facebook SDK集成之纲要篇
- Facebook SDK集成之准备篇
- Facebook SDK集成之登录篇
- 图论——拓扑排序
- 解决Iphone重启后APN数据丢失
- spring3mvc注解版
- ubuntu14.04使用rails连接mysql数据库
- facebook login官方文档iOS
- iOS集成facebook SDK官方文档
- ASP.NET 5系列教程 (五):在Visual Studio 2015中使用Grunt、Bower开发Web程序
- Tomcat8.X安装心得
- des工具类,这样就够了,嘿嘿
- _wait_event 具体实现过程
- 转载-不安装oracle客户端也可以使用pl/sql developer
- java httpURL连接远程服务器并返回数据(httpurlconnection)
- 登陆验证姓名密码,自动登录 ,get获取服务器数据,显示表格形式到界面
- Stanford机器学习课程笔记——LR的公式推导和过拟合问题解决方案