Help Center/Details/

Splash Ads

Introduction

The open-screen advertisement is mainly the full-screen advertisement view displayed when the APP is started. The development can display the designed view as long as the access standard is followed. After the display is completed, it will automatically close and enter the main interface of the application.

Supported ad size: The size of the open-screen ad is the size set when the developer requests the ad. It is recommended that the requested size be set to be consistent with the size of the display area to avoid material distortion.

Permission

**SDK rendering on-screen advertising: ** Open by default
**Template rendering on-screen advertisement: ** Need to apply

SDK rendering on-screen ads

Instructions for use

The SDK renders open-screen ads. Use the BUSplashAdView object to call the loadAdData method to request ads, and use addSubview to add ads for display. By setting the BUSplashAdDelegate agent, you can get callbacks such as ads, display, click, close, and jump.

Create ad slot objects, request ads, display ads

BUSplashAdView

You need to pass in the ad slot object when requesting an ad, and the ad slot ID must be passed in when the ad slot object is created

Required parameters:
Field Definition Field Name Field Type Remarks
SlotID Code bit NSString Slot id
frame Size CGRect Ad request size
Optional parameters:
Field Definition Field Name Field Type Remarks
hideSkipButton Whether to hide the skip button BOOL type Whether to customize the skip button BOOL type The default is NO
tolerateTimeout Timeout NSTimeInterval The default timeout is 3.5s
needSplashZoomOutAd Whether to set the dot-eye advertisement BOOL Whether the dot-eye advertisement is required The default is NO
Note: 3200-3500 version is valid, 3600 and above versions are invalid

Use BUSplashAdView to create an object, use BUSplashAdView to call loadAdData to request ads

CGRect frame = [UIScreen mainScreen].bounds;
self.splashAdView = [[BUSplashAdView alloc] initWithSlotID:normal_splash_ID frame:frame];
// tolerateTimeout = CGFLOAT_MAX, The conversion time to milliseconds will be equal to 0
self.splashAdView.tolerateTimeout = 10;
self.splashAdView.delegate = self;
//optional
self.splashAdView.needSplashZoomOutAd = YES;
UIWindow *keyWindow = self.window;
self.startTime = CACurrentMediaTime();
[self.splashAdView loadAdData];
[keyWindow.rootViewController.view addSubview:self.splashAdView];
self.splashAdView.rootViewController = keyWindow.rootViewController;

Receive ads loading results

BUSplashAdDelegate
Callback Method Notes
splashAd: didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. For details of all error codes, please refer to the link [Link](https://www.pangle.cn/help/doc/5de4cc6d78c8690012a90aa5?from=ad .oceanengine.com&id=5de4cc6d78c8690012a90aa5).
splashAdDidLoad Callback for successful ad loading
BUSplashAdDelegate callback description
Callback Method Notes
splashAdDidLoad: Successful callback of SDK rendering open screen ad loading
splashAd: didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. For details of all error codes, please refer to the link [Link](https://www.pangle.cn/help/doc/5de4cc6d78c8690012a90aa5?from=ad .oceanengine.com&id=5de4cc6d78c8690012a90aa5)
splashAdWillVisible: SDK rendering on-screen ads will be displayed soon
splashAdDidClick: SDK rendering open screen ad click callback
splashAdDidClose: SDK renders the open-screen ad close callback. This callback will be triggered directly when the user clicks on the ad. It is recommended to directly remove the ad object in this callback method
splashAdWillClose: SDK rendering open-screen advertisement is about to close callback
splashAdDidCloseOtherController:(BUSplashAdView *)splashAd interactionType: This callback is called when the ad jumps to another controller and the controller is closed. interactionType: This parameter can distinguish the opened appstore/webpage/video ad details page
splashAdDidClickSkip: This callback is triggered when the user clicks the skip button, and the related logic after the user clicks to jump can be processed in this callback method
splashAdCountdownToZero: This callback will be triggered when the countdown is 0. If the client uses this callback method, it is recommended to remove ads in this callback method

By setting the BUSplashAdDelegate agent, you can get callbacks such as clicks, closes, and jumps of advertisements. For other proxy methods, please refer to the AppDelegate class/BUDSplashViewController class #pragma mark-BUSplashAdView section

Precautions

  1. It is best to place the request of the screen advertisement in the didFinishLaunchingWithOptions callback method for related processing to avoid any form of cache processing. The request for the screen advertisement is placed in the foreground for related processing.
  2. Avoid the situation that the window displaying the advertisement is released in advance or the wrong window is fetched
  3. In the splashAd: didFailWithError: callback method, do the removal of the advertisement object to avoid some specific scenarios caused by the failure of the advertisement request
  4. Make sure to set the Allow Arbitrary Loads permission to avoid situations where certain inventory cannot be loaded
  5. It is recommended to set the timeout time of the on-screen advertisement to 3.5s or more to ensure that it does not conflict with the timeout time of the request of your own project and avoid the scenario of request failure.
  6. The open-screen advertisement returns a view, and the client can display the view directly. If you want to add your own logo at the bottom, you need to reduce the display area of ​​the open-screen advertisement. At this time, when requesting the width and height, fill in the cropped width and height, that is, the requested size is screen width* (screen height-logo height)
  7. In the callback methods of splashAdDidClick, splashAdDidClickSkip, splashAd:didFailWithError, splashAdDidCloseOtherController: interactionType, and splashAdCountdownToZero callback methods to remove ads to avoid abnormal situations: [self.splashView removeSplashView];

resource

For detailed access, please refer to the AppDelegate class/BUDSplashViewController class in the demo, and for the advertisement loading and display request part, please refer to the addSplashAD method/BUDSplashViewController class in the AppDelegate class. The buildupDefaultSplashView method

Template rendering on-screen advertising

Instructions for use

Template rendering open-screen ads use the BUNativeExpressSplashView object to call the loadAdData method to request ads, and use addSubview to add the ad object to display the ad. By setting the BUNativeExpressSplashViewDelegate agent, get the ad, display, Click, close, jump and other callbacks.

Create ad slot objects, request ads, display ads

BUNativeExpressSplashView

You need to pass in the ad slot object when requesting an ad, and the ad slot ID must be passed in when the ad slot object is created

Required parameters:
Field Definition Field Name Field Type Remarks
slotID Code bit NSString Code bit ID
adSize Ad size CGSize Ad request size
Optional parameters:
Field Definition Field Name Field Type Remarks
hideSkipButton Whether to customize the skip button BOOL Whether to customize the skip button The default is NO
tolerateTimeout Timeout NSTimeInterval The default timeout is 3.5s

Use BUNativeExpressSplashView to create objects, use BUNativeExpressSplashView to call loadAdData to request ads, and use addSubview to add advertising objects to display ads

self.splashView = [[BUNativeExpressSplashView alloc] initWithSlotID:self.viewModel.slotID adSize:self.splashFrame.size rootViewController:self];
    self.splashView.delegate = self;
    self.splashView.tolerateTimeout = 10;
    /***
    When the ad loads successfully, WKWebView will be rendered immediately.
    If you want to pre-load, it is recommended to pre-load up to three ads at a time. If more than three, it will cause the rendering of WKWebview to fail.
    */
    [self.splashView loadAdData];
    [self.navigationController.view addSubview:self.splashView];

Custom skip button style

Set the hideSkipButton property of the BUNativeExpressSplashView object to YES, and the client can implement the skip button style and related jump logic by itself.

Receive ads loading results

BUNativeExpressSplashViewDelegate

Callback method Notes
nativeExpressSplashView: didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. Please refer to the link for details of all error codes. Link
nativeExpressSplashViewDidLoad Ad loading successfully callback
nativeExpressSplashViewRenderFail: error: Rendering failed, the rendering failed due to network or hardware reasons, you can change the mobile phone or network environment to test. It is recommended to upgrade to the latest version of the CSJ platform SDK
nativeExpressSplashViewRenderSuccess: Render success callback

BUNativeExpressSplashViewDelegate callback description

Callback method Notes
nativeExpressSplashViewDidLoad: Callback for successful loading of advertising materials
nativeExpressSplashView: didFailWithError: The returned error code (error) indicates the reason why the ad failed to load. Please refer to the link for details of all error codes. Link
nativeExpressSplashViewRenderSuccess: Render success callback
nativeExpressSplashViewRenderFail: error: Rendering failed, the rendering failed due to network or hardware reasons, you can change the mobile phone or network environment to test. It is recommended to upgrade to the latest version of CSJ
SDKnativeExpressSplashViewWillVisible: The template opening ad will be displayed soon
nativeExpressSplashViewDidClick: Click callback
nativeExpressSplashViewDidClickSkip: Click to skip callback
nativeExpressSplashViewCountdownToZero: This callback will be triggered when the countdown is 0. If the client uses this callback method, it is recommended to remove the advertisement in this callback method and set the advertisement object to nil
nativeExpressSplashViewDidClose: Ad close callback. This callback will be triggered directly when the user clicks on the ad. It is recommended to directly remove the ad object in this callback method and set the ad object to nil
nativeExpressSplashViewFinishPlayDidPlayFinish:didFailWithError: This callback will be triggered when the ad is played
nativeExpressSplashViewDidCloseOtherController: interactionType: This callback is called when the ad jumps to another controller and the controller is closed. InteractionType: This parameter can be distinguished from the opened appstore/webpage/video ad details page

By setting the BUNativeExpressSplashViewDelegate agent, you can get the click, close, jump and other callbacks of the advertisement. For other proxy methods, please refer to the BUDExpressSplashViewController class #pragma mark-SplashAdView section

Precautions

  1. It is best to place the request of the screen advertisement in the didFinishLaunchingWithOptions callback method for related processing to avoid any form of cache processing. The request for the screen advertisement is placed in the foreground for related processing.
  2. Avoid the situation where the window that displays the advertisement is released in advance or the wrong** window is fetched
  3. In the nativeExpressSplashView: didFailWithError: callback method, do the operation of the advertising object remove to avoid some specific scenarios caused by the failure of the ad request. Remember to call **removeSplashView before **remove the ad view. **Method, otherwise there may be a countdown problem or a video playback problem, and the advertising object will be blanked
  4. Confirm that the Allow Arbitrary Loads permission is set to avoid the occurrence of certain situations where the inventory cannot be loaded
  5. The timeout time of the on-screen advertisement is set to 3.5s by default, to ensure that it does not conflict with the request timeout time of its own project, and to avoid the scene of request failure
  6. The open-screen advertisement returns a view, and the client can display the view directly. If you want to add your own logo at the bottom, you need to reduce the display area of ​​the open-screen advertisement. At this time, when requesting the width and height, fill in the cropped width and height, that is, the requested size is screen width* (screen height-logo height)
  7. In the callback methods of splashAdDidClick, splashAdDidClickSkip, splashAd:didFailWithError, splashAdDidCloseOtherController: interactionType, and splashAdCountdownToZero, perform the removal operation of advertisements to avoid abnormal situations. The developer needs to call the removeSplashView method provided by the CSJ first, and then use removeFromSuperview to try to remove it from the parent, which requires two removal operations;
  8. The removeSplashView method needs to be called before removeFromSuperview, otherwise there may be a countdown problem or a video playback problem. [self removeSplashAdView];
  9. If you use non-AppDelegate's window for the display of open-screen advertisements, avoid release the window in advance that may cause the ad to be unable to click and jump
  10. **Currently, the open-screen advertisement does not support directly addSubview to the window, otherwise, there may be an abnormal scene of clicking the advertisement to jump. **
  11. The custom skip button for the open-screen advertisement was modified to countdown for the media to handle after 3706, and the version before 3706 is the countdown for SDK processing

resource

For detailed access, please refer to the BUDExpressSplashViewController class in Demo, and for the advertisement loading and display request part, please refer to the buildupDefaultSplashView method in the BUDExpressSplashViewController class.

Innovative style-opening the screen and finishing touch

How to use the screen opening and eye-catching ads: Initialize, add needSplashZoomOutAd settings
If the screen opening and finishing style is connected, the following logic must be implemented

    BUSplashAdView *splashView = [[BUSplashAdView alloc] initWithSlotID:self.viewModel.slotID frame:self.splashFrame];    
    splashView.delegate = self;
    splashView.rootViewController = self;
    splashView.tolerateTimeout = 3;
    //optional 3600版本开始,开发者不需要设置此方法,是否展示点睛样式通过穿山甲平台进行设置。 
    splashView.needSplashZoomOutAd = YES;
    [splashView loadAdData];
    [self.navigationController.view addSubview:splashView];
    self.splashView = splashView;

回调方法的修改, 需要拿到浮窗 view , 调用转场动画
- (void)splashAdDidLoad:(BUSplashAdView *)splashAd {
    [self pbud_logWithSEL:_cmd msg:@""];
    if (splashAd.zoomOutView) {
        // Add this view to your container
        [self.view addSubview:splashAd.zoomOutView];
        splashAd.zoomOutView.rootViewController = self;
        splashAd.zoomOutView.delegate = self;
    }
}


- (void)splashAdDidClick:(BUSplashAdView *)splashAd {
    if (splashAd.zoomOutView) {
        [splashAd.zoomOutView removeFromSuperview];
    }
    [splashAd removeFromSuperview];
    [self pbud_logWithSEL:_cmd msg:@""];
}


- (void)splashAdDidClickSkip:(BUSplashAdView *)splashAd {
    [self handleSplashDimiss:splashAd];
    // 'zoomOutView' is nil, there will be no subsequent operation to completely remove splashAdView and avoid memory leak
    // 'zoomOutView' is not nil,do nothing
    if (!splashAd.zoomOutView) {
        [self removeSplashAdView];
    }
    [self pbud_logWithSEL:_cmd msg:@""];
}


- (void)splashAdCountdownToZero:(BUSplashAdView *)splashAd {
    [self handleSplashDimiss:splashAd];
    // 'zoomOutView' is nil, there will be no subsequent operation to completely remove splashAdView and avoid memory leak
    // 'zoomOutView' is not nil,do nothing
    if (!splashAd.zoomOutView) {
        [self removeSplashAdView];
    }
    [self pbud_logWithSEL:_cmd msg:@""];
}

动画效果可参照 demo 中的实现进行修改
- (void)handleSplashDimiss:(BUSplashAdView *)splashAd {
    if (splashAd.zoomOutView) {
        [[BUDAnimationTool sharedInstance] transitionFromView:splashAd toView:splashAd.zoomOutView];
    } else{
        [splashAd removeFromSuperview];
    }
}
浮窗生命周期的回调可参照 BUSplashZoomOutViewDelegate 文件
Did the content solve your problem?
Contact us