Quick Start For iOS
Quick Start For iOS
Download SDK
Open the "Build Settings" tab of Xcode in your project and add the Facebook SDK folder
path to the "Framework Search Paths" configuration.
2. Copy and paste the XML snippet into the body of your file (<dict>... </dict>).
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>fb708764581454905</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<string>708764581454905</string>
<key>FacebookDisplayName</key>
<string>FYTme</string>
3. If you use any Facebook dialogs (e.g., Login, Share, App Invitations, etc.) that might
perform an app switch to Facebook apps, your app's .plist will need to consider that as
well.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
4. Add a compiler flag to your build settings for compatibility with the Facebook SDK for
iOS.
1. Go to Project Navigator in Xcode and select your project to see the project
settings.
3. Add the -ObjC flag to the Other Connection Builder flags for all build targets.
Package Identifier
com.example.fytme
#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (void)applicationDidBecomeActive:(UIApplication *)application {
[FBSDKAppEvents activateApp];
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
didFinishLaunchingWithOptions:launchOptions];
return YES;
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
openURL:url
sourceApplication:sourceApplication
annotation:annotation];
When people install or engage with your app, you'll see that data reflected in your
app's Insights dashboard.
#import <FBSDKLoginKit/FBSDKLoginKit.h>
loginButton.center = self.view.center;
[self.view addSubview:loginButton];
If you haven't already done so, add the following to your app's AppDelegate.m file:
#import <FBSDKCoreKit/FBSDKCoreKit.h>
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
sourceApplication:sourceApplication
annotation:annotation];
Now build and run your application. You should see a Facebook Sign In button. If you're
able to sign in to your app, the integration was successful.
Next steps
Congratulations! You've added the Facebook SDK to your project. Now you're at the next
step of integrating your app with Facebook. What do you want to do next? Skip to
Developer Dashboard or Documentation