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;
Swiftinit(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;
Swiftconvenienceinit(placementID:String,bidPayload:String,rootViewController:UIViewController?)throws
Parameters
- Begins loading the FBAdView content.You can implement
adViewDidLoad:
andadView:didFailWithError:
methods ofFBAdViewDelegate
if you would like to be notified as loading succeeds or fails.Declaration
Objective-C-(void)loadAd;
SwiftfuncloadAd()
- Begins loading the FBAdView content from a bid payload attained through a server side bid.You can implement
adViewDidLoad:
andadView:didFailWithError:
methods ofFBAdViewDelegate
if you would like to be notified as loading succeeds or fails.Declaration
Objective-C-(void)loadAdWithBidPayload:(nonnullNSString*)bidPayload;
SwiftfuncloadAd(withBidPayloadbidPayload:String)
Parameters
- DeprecatedThere is no reason to call this method anymore. Autorefresh is disabled by default.
Declaration
Objective-C-(void)disableAutoRefresh;
SwiftfuncdisableAutoRefresh()
- Typed access to the id of the ad placement.
Declaration
Objective-C@property(nonatomic,copy,readonly)NSString*_NonnullplacementID;
SwiftvarplacementID:String{get}
- Typed access to the app’s root view controller.
Declaration
Objective-C@property(nonatomic,weak,readonly,nullable)UIViewController*rootViewController;
SwiftweakvarrootViewController:UIViewController?{get}
- Call isAdValid to check whether ad is valid
Declaration
Objective-C@property(nonatomic,readonly,getter=isAdValid)BOOLadValid;
SwiftvarisAdValid:Bool{get}
- the delegate
Declaration
Objective-C@property(nonatomic,weak,nullable)id<FBAdViewDelegate>delegate;
Swiftweakvardelegate:FBAdViewDelegate?{getset}
- FBAdExtraHint to provide extra info
Declaration
Objective-C@property(nonatomic,strong,nullable)FBAdExtraHint*extraHint;
SwiftvarextraHint:FBAdExtraHint?{getset}