Interstitial

Display interstitial ads

To display interstitial ads, use the showAd function as shown in the example below:

#import <Bidease/Bidease.h>

NS_ASSUME_NONNULL_BEGIN

@interface ViewController : UIViewController<BideaseShowDelegate>

@property(nonatomic) BideaseInterstitial* interstitial;

@end

NS_ASSUME_NONNULL_END

@implementation ViewController

- (id)initWithCoder:(NSCoder *)coder
{
    if (self = [super initWithCoder:coder])
    {
        _interstitial = [[BideaseInterstitial alloc]initWithPlacementId:@"PlacementID"];
    }

    return self;
}

-(void)showAd
{
    __weak typeof(self)weakSelf = self;
    [interstitial bidWithCompletion:^(id<BDEAuctionBid> bid, NSString* requestId, NSError* error) {

        if (nil == bid)
        {
            NSLog(@"Bid failed %@", error);
            return;
        }

        [bid onWin:nil];

        [weakSelf.interstitial loadWithBid:bid completion:^(id<BideaseAd> _Nullable ad, NSError * _Nullable error) {

            if (nil == ad)
            {
                NSLog(@"Load failed %@", error);
                return;
            }

            ViewController* strongSelf = weakSelf;
            if (nil != strongSelf)
            {
                [strongSelf.interstitial showWithDelegate:strongSelf];
            }
        }];
    }];
}

#pragma mark - BideaseShowDelegate methods

-(void)onAdWillAppear:(id<BideaseAd>)ad sender:(BideaseFullscreen *)sender
{
    NSLog(@"onAdWillAppear");
}

-(void)onAdDidDisappear:(id<BideaseAd>)ad sender:(BideaseFullscreen *)sender
{
    NSLog(@"onAdDidDisappear");
}

-(void)onAdClicked:(id<BideaseAd>)ad error:(NSError*)error sender:(BideaseFullscreen *)sender
{
    NSLog(@"onAdClicked");
}

-(void)onAdReported:(id<BideaseAd>)ad reason:(NSString *)reason sender:(BideaseFullscreen *)sender
{
    NSLog(@"onAdReported");
}

-(BOOL)shouldShowAd:(BideaseFullscreen *)sender
{
    return YES;
}

-(void)onAdFailedToAppear:(id<BideaseAd>)ad error:(NSError *)error sender:(BideaseFullscreen *)sender
{
    NSLog(@"onAdFailedToAppear %@", error.localizedDescription);
}

@end
import Bidease

class ViewController: UIViewController , BideaseShowDelegate {

    let interstitial:BideaseInterstitial

    func showAd() {

        let inter = interstitial
        inter.bid { [weak self] bid, requestId, error in

            guard let bid = bid else {
                print("Bid failed")
                return
            }

            bid.onWin(nil)

            inter.load(with: bid) { ad, error in

                guard nil != ad else {
                    print("Load failed")
                    return
                }

                if let delegate = self {
                    inter.show(with: delegate)
                }
            }
        }
    }

    required init?(coder: NSCoder) {
        interstitial = BideaseInterstitial(placementId: "PlacementID")

        super.init(coder: coder)
    }

    func onAdWillAppear(_ ad: any BideaseAd, sender: BideaseFullscreen) {
        print("onAdWillAppear");
    }

    func onAdDidDisappear(_ ad: any BideaseAd, sender: BideaseFullscreen) {
        print("onAdFailedToAppear")
    }

    func onAdFailed(toAppear ad: (any BideaseAd)?, error: Error, sender: BideaseFullscreen) {
        print("onAdFailedToAppear")
    }

    func onAdClicked(_ ad: any BideaseAd, sender: BideaseFullscreen) {
        print("onAdClicked");
    }

    func shouldShowAd(_ sender: BideaseFullscreen) -> Bool {
        return true
    }
}

Placement ID & floors

  • Placement ID: use the format AdFormat_ecpm_X.X , where ecpm is the required separator and X.X is the floor price value (any number).
    • Example: Interstitial_ecpm_1.3 ➡️ floor price = $1.3

Tips

  • Always call show on the main thread.
  • Handle both bid and load failures; avoid retry loops without backoff.
  • Keep the interstitial instance alive (e.g., as a view controller property) across the full load/show lifecycle.