iOS SDK Version

FBAdView

Objective-C
@interfaceFBAdView:UIView
Swift
classFBAdView:UIView
A customized UIView to represent a Facebook ad (a.k.a. banner ad).
  • This is a method to initialize an FBAdView matching the given placement id.

    Declaration

    Objective-C
    -(nonnullinstancetype)initWithPlacementID:(nonnullNSString*)placementIDadSize:(FBAdSize)adSizerootViewController:(nullableUIViewController*)rootViewController;
    Swift
    init(placementID:String,adSize:FBAdSize,rootViewController:UIViewController?)

    Parameters

  • This is a method to initialize an FBAdView matching the given placement id with a given bidding payload.

    Declaration

    Objective-C
    -(nullableinstancetype)initWithPlacementID:(nonnullNSString*)placementIDbidPayload:(nonnullNSString*)bidPayloadrootViewController:(nullableUIViewController*)rootViewControllererror:(NSError*_Nullable*_Nullable)error;
    Swift
    convenienceinit(placementID:String,bidPayload:String,rootViewController:UIViewController?)throws

    Parameters

  • Begins loading the FBAdView content.
    You can implement adViewDidLoad: and adView:didFailWithError: methods of FBAdViewDelegate if you would like to be notified as loading succeeds or fails.

    Declaration

    Objective-C
    -(void)loadAd;
    Swift
    funcloadAd()
  • Begins loading the FBAdView content from a bid payload attained through a server side bid.
    You can implement adViewDidLoad: and adView:didFailWithError: methods of FBAdViewDelegate if you would like to be notified as loading succeeds or fails.

    Declaration

    Objective-C
    -(void)loadAdWithBidPayload:(nonnullNSString*)bidPayload;
    Swift
    funcloadAd(withBidPayloadbidPayload:String)

    Parameters

  • Deprecated
    There is no reason to call this method anymore. Autorefresh is disabled by default.

    Declaration

    Objective-C
    -(void)disableAutoRefresh;
    Swift
    funcdisableAutoRefresh()
  • Typed access to the id of the ad placement.

    Declaration

    Objective-C
    @property(nonatomic,copy,readonly)NSString*_NonnullplacementID;
    Swift
    varplacementID:String{get}
  • Typed access to the app’s root view controller.

    Declaration

    Objective-C
    @property(nonatomic,weak,readonly,nullable)UIViewController*rootViewController;
    Swift
    weakvarrootViewController:UIViewController?{get}
  • Call isAdValid to check whether ad is valid

    Declaration

    Objective-C
    @property(nonatomic,readonly,getter=isAdValid)BOOLadValid;
    Swift
    varisAdValid:Bool{get}
  • the delegate

    Declaration

    Objective-C
    @property(nonatomic,weak,nullable)id<FBAdViewDelegate>delegate;
    Swift
    weakvardelegate:FBAdViewDelegate?{getset}
  • FBAdExtraHint to provide extra info

    Declaration

    Objective-C
    @property(nonatomic,strong,nullable)FBAdExtraHint*extraHint;
    Swift
    varextraHint:FBAdExtraHint?{getset}