Advanced Topics - Facebook SDK for iOS

- Create a Simulator Build

- Build from Source

- Swift

- Advanced App Configuration

Create a Simulator Build (for App Review)

If you create an app that uses Facebook Login you need to submit for review. See Review Guidelines.

For iOS apps, you should generate a simulator binary package and upload it for us to use as part of the review process. To generate a simulator build:

1. Step: Run App in Simulator

Run your app in your Xcode iPhone 5 simulator. This automatically creates a simulator build in Xcode's DerivedData cache.

2. Step: ZIP Simulator Build

Zip the simulator build via the following command:

ditto -ck --sequesterRsrc --keepParent `ls -1 -d -t ~/Library/Developer/Xcode/DerivedData/*/Build/Products/*-iphonesimulator/*.app | head -n 1` path/to/YourApp.zip

3. Step: Verify Build

You can verify the simulator build by using the ios-sim utility Command-line App Launcher for Simulator. Once installed run:

ios-sim launch /path/to/your-app.app

4. Step: Submit for Review

Submit file zip file (e.g. YourApp.zip) using your app dashboard. Please note that we delete the simulator build you provide three weeks after your submission has been actioned, i.e. reviewed or canceled.

Build from Source

You can also get the source for for the SDK on GitHub, with CocoaPods supported. See GitHub, Facebook iOS SDK Source.

You need the latest Xcode and iOS SDK, which is Xcode 6/iOS 8 at this time.

If you have Git, create a local repository by cloning it your chosen location:

git clone git://github.com/facebook/facebook-ios-sdk.git

Then build the SDK from source before you compile and run any samples:

./scripts/build_framework.sh    

CocoaPods

You can also include the SDK via CocoaPods by adding the following to your Podfile.

pod 'FBSDKCoreKit'
pod 'FBSDKShareKit'
pod 'FBSDKLoginKit'

If you're using the use_frameworks! flag, you must also add pod 'Bolts' before the FBSDKCoreKit dependency.

Swift

v4.1 of the SDK supports modules natively so no bridging headers are required. Simply import the appropriate kit module in your .swift files, such as

import FBSDKCoreKit
import FBSDKShareKit
import FBSDKLoginKit

Advanced App Configuration

Optionally, if you want all the SDK classes to work out of the box you can also add the -ObjC linker flag to your project.

If you to do this you increase the size of your app's executable since the due to additional SDK object code loads into your application.

You can learn more about the trade offs, about the -ObjC flag, and how to set it in our iOS Troubleshooting, Unrecognized Selector Error.

Troubleshooting

Tips on common scenarios, workarounds for major known issues.

FAQs and Troubleshooting