Facebook SDK for IOS Upgrade Guide

It's important to upgrade your projects to use the latest version of the Facebook SDK. This topic provides the steps to do so.

Review the Changes in the Latest Version

Before you upgrade to a new version of the Facebook SDK, you should review the Changelog on GitHub. This will help you understand any changes that you will need to make in your code as the result of an upgrade.

Note: If you are upgrading to version 9.0.0 or later, the autoInitEnabled option has been removed from the SDK. You must initialize the SDK explicitly with the initializeSDK method or implicitly by calling it in applicationDidFinishLaunching. For more information, see the 9.0.0 section of the Changelog.

Upgrade Using Swift Package Manager (SPM)

If your app is using SPM to integrate with the Facebook SDK for iOS, follow these steps.

Note that the quickstart in the preceding link instructs you to select Up to Next Major Version for the Version option, meaning the tool will not automatically update past the major version you specified. (if you select 8.x.x, it won’t upgrade to a major version 9.x.x). This helps prevent an update to a version that is incompatible with the current package you are using.

Incremental Update

If the version update is incremental (minor or patch version is incremented)

In Xcode, click File > Swift Packages > Update to Latest Package Versions.

The following image shows an example:

Major Version Update

Before you upgrade the major version, make sure and check the changelogs. If the version update is a major version change, you may need to change the package settings.

  1. Go to your project settings and click the Swift Packages tab. The following image shows an example:

  2. Select the Facebook package to display its settings. Change the Version to the major version you wish to upgrade to, in this example image, 9.0.0, and click Done.

  3. Now upgrade the package. In Xcode, click File > Swift Packages > Update to Latest Package Versions. The following image shows an example:

  4. Note that you can roll back the target version by changing the major version target in the project settings, and rerunning Update to Latest Package Versions.

Upgrade Using CocoaPods

If your app integrates with the Facebook SDK for iOS using Cocoapods, follow these steps.

  1. Check if pods are out of date. The following command will list the pods that are out of date.

    pod outdated
    
  2. Update the pods that are out of date with the following command.

    pod update  [PODNAME]
    

Note that CocoaPods will try to find an updated version of the pod specified by [PODNAME], and it will update the pod to the latest version possible following any version restrictions in your Podfile. If you have version restrictions, you may need to modify those to upgrade between major versions.

Recompile and Resolve Issues

When you have finished upgrading the target SDKs, recompile and fix any resulting issues. Typically you should only see issues when you upgrade to a new major version.

Make sure and consult the Changelog on GitHub to understand any compile issues you might encounter.

Upgrade to a New Graph API Version

If you want to upgrade to a new version of Graph API, you can use the Upgrade Tool to assess the changes you will need to make to your app. You can also review the Graph API Changelog.