Skip to main content

Overview

Settings exposes the configuration options that control how the SDK behaves throughout your app. Most properties read their default values from your Info.plist, but you can override any of them in code before calling ApplicationDelegate.shared.application(_:didFinishLaunchingWithOptions:).
ModuleFacebookCore
Objective-C nameFBSDKSettings
AvailabilityiOS 12+

Singleton

shared
Settings
The shared settings instance. Prefer instance methods on this object over type-level properties and methods.
let settings = Settings.shared

Identity properties

appID
String?
Your Facebook App ID. The SDK reads this automatically from the FacebookAppID key in your Info.plist. You can override it in code before the SDK initializes.Info.plist key: FacebookAppID
clientToken
String?
The client token for your Facebook app, used for anonymous API calls made without a user access token. Find it in the Facebook Developer Dashboard under Settings → Advanced → Security.Info.plist key: FacebookClientToken
displayName
String?
The display name for your app. This should match the name set in the Facebook App Dashboard.Info.plist key: FacebookDisplayName
appURLSchemeSuffix
String?
The URL scheme suffix used to differentiate multiple Facebook apps on the same device. Only set this if your app uses a custom URL scheme suffix.Info.plist key: FacebookUrlSchemeSuffix

Data collection properties

isAutoLogAppEventsEnabled
Bool
Controls whether the SDK automatically logs basic app events such as app installs and app launches. Defaults to true. Set to false and then back to true after you have received user consent.Info.plist key: FacebookAutoLogAppEventsEnabled
isAdvertiserIDCollectionEnabled
Bool
Controls whether the SDK reads the device Advertiser ID (IDFA). Defaults to true. Disable this if you do not use the IDFA for advertising.Info.plist key: FacebookAdvertiserIDCollectionEnabled
isAdvertiserTrackingEnabled
Bool
Reflects the advertiser tracking status of data sent to Facebook. On iOS 17+, this value is determined by ATTrackingManager.trackingAuthorizationStatus and cannot be set manually.
The setter for this property is deprecated on iOS 17+ and has no effect when domain handling is enabled. Use App Tracking Transparency (ATTrackingManager) instead.

Logging properties

loggingBehaviors
Set<LoggingBehavior>
The set of active logging behaviors. The default set contains only .developerErrors. Set this to an empty set to disable all logging.You can also configure this via the FacebookLoggingBehavior array key in your Info.plist.Common values:
ValueDescription
.developerErrorsLogs SDK usage errors. Enabled by default.
.networkRequestsLogs all Graph API requests and responses.
.graphAPIDebugInfoIncludes debug info from the Graph API.
.graphAPIDebugWarningIncludes debug warnings from the Graph API.
.appEventsLogs app event activity.
.informationalGeneral SDK informational messages.
sdkVersion
String
The version string of the Facebook SDK currently in use. Read-only.

Logging methods

enableLoggingBehavior(_:)

Adds a single logging behavior to the active set.
public func enableLoggingBehavior(_ loggingBehavior: LoggingBehavior)
body.loggingBehavior
LoggingBehavior
required
The behavior to enable, such as .networkRequests or .appEvents.

disableLoggingBehavior(_:)

Removes a single logging behavior from the active set.
public func disableLoggingBehavior(_ loggingBehavior: LoggingBehavior)
body.loggingBehavior
LoggingBehavior
required
The behavior to disable.

setDataProcessingOptions(_:)

Sets data processing options, for example to enable Limited Data Use (LDU) mode.
public func setDataProcessingOptions(_ options: [String]?)
body.options
[String]?
required
An array of processing option strings, or nil to clear all options. Pass ["LDU"] to enable Limited Data Use.

setDataProcessingOptions(_:country:state:)

Sets data processing options with an explicit country and state code.
public func setDataProcessingOptions(_ options: [String]?, country: Int32, state: Int32)
body.options
[String]?
required
An array of processing option strings, or nil to clear.
body.country
Int32
required
The numeric country code.
body.state
Int32
required
The numeric state code.

Usage example

Configure the SDK programmatically before initialization:
import UIKit
import FacebookCore

@main
class AppDelegate: UIResponder, UIApplicationDelegate {

    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        // Override Info.plist values if needed
        Settings.shared.appID = "YOUR_APP_ID"
        Settings.shared.clientToken = "YOUR_CLIENT_TOKEN"
        Settings.shared.displayName = "My App"

        // Disable auto-logging until the user consents
        Settings.shared.isAutoLogAppEventsEnabled = false

        // Enable network request logging during development
        Settings.shared.enableLoggingBehavior(.networkRequests)

        // Enable Limited Data Use for California users
        Settings.shared.setDataProcessingOptions(["LDU"], country: 1, state: 5)

        ApplicationDelegate.shared.application(
            application,
            didFinishLaunchingWithOptions: launchOptions
        )
        return true
    }
}
Where possible, configure appID and clientToken in your Info.plist rather than in code. This avoids accidental commits of credentials and keeps configuration out of your source files.

Build docs developers (and LLMs) love