iOS SDK Version

FBAdSettings

Objective-C
@interfaceFBAdSettings:NSObject
Swift
classFBAdSettings:NSObject
AdSettings contains global settings for all ad controls.
  • Controls support for audio-only video playback when the app is backgrounded. Note that this is only supported when using FBMediaViewVideoRenderer, and requires corresponding support for background audio to be added to the app. Default value is NO.

    Declaration

    Objective-C
    @property(class,nonatomic,assign,unsafe_unretained,readwrite,getter=isBackgroundVideoPlaybackAllowed)BOOLbackgroundVideoPlaybackAllowed;
    Swift
    classvarisBackgroundVideoPlaybackAllowed:Bool{getset}
  • When test mode is on, setting a non default value for testAdType will requests the specified type of ad.

    Declaration

    Objective-C
    @property(class,nonatomic)FBAdTestAdTypetestAdType;
    Swift
    classvartestAdType:FBAdTestAdType{getset}
  • When this delegate is set, logs will be redirected to the delegate instead of being logged directly to the console with NSLog. This can be used in combination with external logging frameworks.

    Declaration

    Objective-C
    @property(class,nonatomic,weak,nullable)id<FBAdLoggingDelegate>loggingDelegate;
    Swift
    weakclassvarloggingDelegate:FBAdLoggingDelegate?{getset}
  • Generates bidder token that needs to be included in the server side bid request to Facebook endpoint.

    Declaration

    Objective-C
    @property(class,nonatomic,copy,readonly)NSString*_NonnullbidderToken;
    Swift
    classvarbidderToken:String{get}
  • Generates routing token needed for requests routing in reverse-proxy, since we don’t have cookies in app environments.

    Declaration

    Objective-C
    @property(class,nonatomic,copy,readonly)NSString*_NonnullroutingToken;
    Swift
    classvarroutingToken:String{get}
  • User’s consent for advertiser tracking.
    The setter API only works in iOS14 or above and won’t take effect in iOS13 or below.

    Declaration

    Objective-C
    +(void)setAdvertiserTrackingEnabled:(BOOL)advertiserTrackingEnabled;
    Swift
    classfuncsetAdvertiserTrackingEnabled(_advertiserTrackingEnabled:Bool)
  • Returns test mode on/off.

    Declaration

    Objective-C
    +(BOOL)isTestMode;
    Swift
    classfuncisTestMode()->Bool
  • Returns the hashid of the device to use test mode on.

    Declaration

    Objective-C
    +(nonnullNSString*)testDeviceHash;
    Swift
    classfunctestDeviceHash()->String
  • Adds a test device.
    Copy the current device Id from debug log and add it as a test device to get test ads. Apps running on emulator will automatically get test ads. Test devices should be added before loadAd is called.

    Declaration

    Objective-C
    +(void)addTestDevice:(nonnullNSString*)deviceHash;
    Swift
    classfuncaddTestDevice(_deviceHash:String)

    Parameters

  • Add a collection of test devices. See +addTestDevices: for details.

    Declaration

    Objective-C
    +(void)addTestDevices:(nonnullNSArray<NSString*>*)devicesHash;
    Swift
    classfuncaddTestDevices(_devicesHash:[String])

    Parameters

  • Clear all the added test devices

    Declaration

    Objective-C
    +(void)clearTestDevices;
    Swift
    classfuncclearTestDevices()
  • Clears the added test device

    Declaration

    Objective-C
    +(void)clearTestDevice:(nonnullNSString*)deviceHash;
    Swift
    classfuncclearTestDevice(_deviceHash:String)

    Parameters

  • Deprecated
    isChildDirected method is no longer supported in Audience Network. Use +mixedAudience instead
    Configures the ad control for treatment as child-directed.
    Note that you may have other legal obligations under the Children’s Online Privacy Protection Act (COPPA). Please review the FTC’s guidance and consult with your own legal counsel.

    Declaration

    Objective-C
    +(void)setIsChildDirected:(BOOL)isChildDirected;
    Swift
    classfuncsetIsChildDirected(_isChildDirected:Bool)

    Parameters

  • Configures the ad control for treatment as mixed audience directed. Information for Mixed Audience Apps and Services: https://developers.facebook.com/docs/audience-network/coppa

    Declaration

    Objective-C
    @property(class,nonatomic,assign,unsafe_unretained,readwrite,getter=isMixedAudience)BOOLmixedAudience;
    Swift
    classvarisMixedAudience:Bool{getset}
  • If an ad provided service is mediating Audience Network in their sdk, it is required to set the name of the mediation service

    Declaration

    Objective-C
    +(void)setMediationService:(nonnullNSString*)service;
    Swift
    classfuncsetMediationService(_service:String)

    Parameters

  • Gets the url prefix to use when making ad requests.
    This method should never be used in production.

    Declaration

    Objective-C
    +(nullableNSString*)urlPrefix;
    Swift
    classfuncurlPrefix()->String?
  • Sets the url prefix to use when making ad requests.
    This method should never be used in production.

    Declaration

    Objective-C
    +(void)setUrlPrefix:(nullableNSString*)urlPrefix;
    Swift
    classfuncsetUrlPrefix(_urlPrefix:String?)
  • Gets the current SDK logging level

    Declaration

    Objective-C
    +(FBAdLogLevel)getLogLevel;
    Swift
    classfuncgetLogLevel()->FBAdLogLevel
  • Sets the current SDK logging level

    Declaration

    Objective-C
    +(void)setLogLevel:(FBAdLogLevel)level;
    Swift
    classfuncsetLogLevel(_level:FBAdLogLevel)
  • Data processing options. Please read more details at https://developers.facebook.com/docs/marketing-apis/data-processing-options

    Declaration

    Objective-C
    +(void)setDataProcessingOptions:(nonnullNSArray<NSString*>*)optionscountry:(NSInteger)countrystate:(NSInteger)state;
    Swift
    classfuncsetDataProcessingOptions(_options:[String],country:Int,state:Int)

    Parameters

  • Data processing options. Please read more details at https://developers.facebook.com/docs/marketing-apis/data-processing-options

    Declaration

    Objective-C
    +(void)setDataProcessingOptions:(nonnullNSArray<NSString*>*)options;
    Swift
    classfuncsetDataProcessingOptions(_options:[String])

    Parameters