Commit 1634812e by 刘卓鑫

no message

parent d84c010a
/*
BULanguage.strings
BUAdSDK
Created by 李盛 on 2019/1/7.
Copyright © 2019 bytedance. All rights reserved.
*/
// String
"Click" = "Click";
"AD" = "AD";
"PlayConsumed" = "%.2fMB traffic will be consumed if you play it";
"Evaluation" = "Evaluation";
"Score" = "%@ score";
"Select" = "Select";
"Back" = "Back";
"Replay" = "Click to replay";
"Continue" = "Continue to play";
"Skip" = "Skip";
"ViewNow" = "View now";
"Download" = "Download";
"LoadFailure" = "Failed to load, and click to try again";
"GetRewardAfterWatching" = "Get reward after watching the full video";
"GiveUpReward" = "Give up reward";
"ContinueWatching" = "Continue watching";
"CanbeTurnedOffAfter" = "can be turned off after %ds";
"Get" = "Get";
"View" = "View";
// Icon
/*
BULanguage.strings
BUAdSDK
Created by 李盛 on 2019/1/7.
Copyright © 2019 bytedance. All rights reserved.
*/
// String
"Click" = "クリック";
"AD" = "広告";
"PlayConsumed" = "再生すると%.2fMBの通信量が消費されます";
"Evaluation" = "評価";
"Score" = "評価数:%@";
"Select" = "選択";
"Back" = "戻る";
"Replay" = "リプレイ";
"Continue" = "再生し続ける";
"Skip" = "skip";
"ViewNow" = "詳細を見る";
"Download" = "download";
"LoadFailure" = "ロードに失敗しました。クリックして再度お試しください";
"GetRewardAfterWatching" = "動画を最後まで視聴いただけるとリワードを付与されます";
"GiveUpReward" = "リワード不要";
"ContinueWatching" = "視聴し続ける";
"CanbeTurnedOffAfter" = "%ds後に閉じられます";
"Get" = "Get";
"View" = "View";
// Icon
/*
BULanguage.strings
BUAdSDK
Created by 李盛 on 2019/1/7.
Copyright © 2019 bytedance. All rights reserved.
*/
// String
"Click" = "点击";
"AD" = "广告";
"PlayConsumed" = "播放将消耗%.2fMB流量";
"Evaluation" = "评价";
"Score" = "%@个评分";
"Select" = "选择";
"Back" = "返回";
"Replay" = "点击重播";
"Continue" = "继续播放";
"Skip" = "跳过";
"ViewNow" = "立即查看";
"Download" = "立即下载";
"LoadFailure" = "加载失败,点击重试";
"GetRewardAfterWatching" = "观看完整视频才能获得奖励";
"GiveUpReward" = "放弃奖励";
"ContinueWatching" = "继续观看";
"CanbeTurnedOffAfter" = "%ds后可关闭";
"Get" = "下载";
"View" = "查看";
// Icon
framework module BUAdSDK {
umbrella header "BUAdSDK.h"
export *
module * { export * }
}
//
// BUAdSDK.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
// In this header, you should import all the public headers of your framework using statements like #import <BUAdSDK/PublicHeader.h>
#import <BUAdSDK/BUAdSDKDefines.h>
#import <BUAdSDK/BUAdSDKManager.h>
#import <BUAdSDK/BUAdSDKError.h>
#import <BUAdSDK/BUAdSlot.h>
#import <BUAdSDK/BUImage.h>
#import <BUAdSDK/BUSize.h>
#import <BUAdSDK/BUMaterialMeta.h>
#import <BUAdSDK/BUPlayerPublicDefine.h>
#import <BUAdSDK/BUVideoAdView.h>
///customize dislike style
#import <BUAdSDK/BUDislike.h>
#import <BUAdSDK/BUDislikeWords.h>
/// native ads
#import <BUAdSDK/BUNativeAd.h>
#import <BUAdSDK/BUNativeAdRelatedView.h>
#import <BUAdSDK/BUNativeAdsManager.h>
/// native express ads
#import <BUAdSDK/BUNativeExpressAdManager.h>
#import <BUAdSDK/BUNativeExpressAdView.h>
#import <BUAdSDK/BUNativeExpressBannerView.h>
#import <BUAdSDK/BUNativeExpressInterstitialAd.h>
#import <BUAdSDK/BUNativeExpressRewardedVideoAd.h>
#import <BUAdSDK/BUNativeExpressFullscreenVideoAd.h>
/// banner ads
#import <BUAdSDK/BUBannerAdView.h>
/// splash ads
#import <BUAdSDK/BUSplashAdView.h>
/// interstitial ads
#import <BUAdSDK/BUInterstitialAd.h>
/// rewarded video ads
#import <BUAdSDK/BURewardedVideoModel.h>
#import <BUAdSDK/BURewardedVideoAd.h>
/// full-screen video ads
#import <BUAdSDK/BUFullscreenVideoAd.h>
/// playable tool
#import <BUAdSDK/BUAdSDKPlayableToolManager.h>
//
// BUAdSDKDefines.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#ifndef BUAdSDK_DEFINES_h
#define BUAdSDK_DEFINES_h
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, BUUserGender) {
BUUserGenderUnknown,
BUUserGenderMan,
BUUserGenderWoman,
};
typedef NS_ENUM(NSInteger, BUAdSDKLogLevel) {
BUAdSDKLogLevelNone,
BUAdSDKLogLevelError,
BUAdSDKLogLevelDebug
};
typedef NS_ENUM(NSInteger, BURitSceneType) {
BURitSceneType_custom = 0,//custom
BURitSceneType_home_open_bonus = 1,//Login/open rewards (login, sign-in, offline rewards doubling, etc.)
BURitSceneType_home_svip_bonus = 2,//Special privileges (VIP privileges, daily rewards, etc.)
BURitSceneType_home_get_props = 3,//Watch rewarded video ad to gain skin, props, levels, skills, etc
BURitSceneType_home_try_props = 4,//Watch rewarded video ad to try out skins, props, levels, skills, etc
BURitSceneType_home_get_bonus = 5,//Watch rewarded video ad to get gold COINS, diamonds, etc
BURitSceneType_home_gift_bonus = 6,//Sweepstakes, turntables, gift boxes, etc
BURitSceneType_game_start_bonus = 7,//Before the opening to obtain physical strength, opening to strengthen, opening buff, task props
BURitSceneType_game_reduce_waiting = 8,//Reduce wait and cooldown on skill CD, building CD, quest CD, etc
BURitSceneType_game_more_opportunities = 9,//More chances (resurrect death, extra game time, decrypt tips, etc.)
BURitSceneType_game_finish_rewards = 10,//Settlement multiple times/extra bonus (completion of chapter, victory over boss, first place, etc.)
BURitSceneType_game_gift_bonus = 11//The game dropped treasure box, treasures and so on
};
@protocol BUToDictionary <NSObject>
- (NSDictionary *)dictionaryValue;
@end
#endif
//
// BUAdSDKError.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
extern NSErrorDomain BUErrorDomain ;
typedef NS_ENUM(NSInteger, BUErrorCode) {
BUErrorCodeTempError = -6, // native template is invalid
BUErrorCodeTempAddationError= -5, // native template addation is invalid
BUErrorCodeOpenAPPStoreFail = -4, // failed to open appstore
BUErrorCodeNOAdError = -3, // parsed data has no ads
BUErrorCodeNetError = -2, // network request failed
BUErrorCodeParseError = -1, // parsing failed
BUErrorCodePlayableError_ERR_HAS_CACHE = -702, // has cache
BUErrorCodePlayableError_ERR_UNZIP = -704, // unzip error
BUErrorCodeNERenderResultError= 101, // native Express ad, render result parse fail
BUErrorCodeNETempError = 102, // native Express ad, template is invalid
BUErrorCodeNETempPluginError = 103, // native Express ad, template plugin is invalid
BUErrorCodeNEDataError = 104, // native Express ad, data is invalid
BUErrorCodeNEParseError = 105, // native Express ad, parse fail
BUErrorCodeNERenderError = 106, // native Express ad, render fail
BUErrorCodeNERenderTimoutError= 107, // native Express ad, render timeout
BUErrorCodeSDKStop = 1000, // SDK stop forcely
BUErrorCodeParamError = 10001, // parameter error
BUErrorCodeTimeout = 10002,
BUErrorCodeSuccess = 20000,
BUErrorCodeNOAD = 20001, // no ads
BUErrorCodeContentType = 40000, // http conent_type error
BUErrorCodeRequestPBError = 40001, // http request pb error
BUErrorCodeAppEmpty = 40002, // request app can't be empty
BUErrorCodeWapEMpty = 40003, // request wap can't be empty
BUErrorCodeAdSlotEmpty = 40004, // missing ad slot description
BUErrorCodeAdSlotSizeEmpty = 40005, // the ad slot size is invalid
BUErrorCodeAdSlotIDError = 40006, // the ad slot ID is invalid
BUErrorCodeAdCountError = 40007, // request the wrong number of ads
BUUnionAdImageSizeError = 40008, // wrong image size
BUUnionAdSiteIdError = 40009, // Media ID is illegal
BUUnionAdSiteMeiaTypeError = 40010, // Media type is illegal
BUUnionAdSiteAdTypeError = 40011, // Ad type is illegal
BUUnionAdSiteAccessMethodError = 40012,// Media access type is illegal and has been deprecated
BUUnionSplashAdTypeError = 40013, // Code bit id is less than 900 million, but adType is not splash ad
BUUnionRedirectError = 40014, // The redirect parameter is incorrect
BUUnionRequestInvalidError = 40015, // Media rectification exceeds deadline, request illegal
BUUnionAppSiteRelError = 40016, // The relationship between slot_id and app_id is invalid.
BUUnionAccessMethodError = 40017, // Media access type is not legal API/SDK
BUUnionPackageNameError = 40018, // Media package name is inconsistent with entry
BUUnionConfigurationError = 40019, // Media configuration ad type is inconsistent with request
BUUnionRequestLimitError = 40020, // The ad space registered by developers exceeds daily request limit
BUUnionSignatureError = 40021, // Apk signature sha1 value is inconsistent with media platform entry
BUUnionIncompleteError = 40022, // Whether the media request material is inconsistent with the media platform entry
BUUnionOSError = 40023, // The OS field is incorrectly filled
BUUnionLowVersion = 40024, // The SDK version is too low to return ads
BUErrorCodeAdPackageIncomplete = 40025,// the SDK package is incomplete. It is recommended to verify the integrity of SDK package or contact technical support.
BUUnionMedialCheckError = 40026, // Non-international account request for overseas delivery system
BUErrorCodeSysError = 50001 // ad server error
};
//
// BUAdSDKManager.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BUAdSDKDefines.h"
@interface BUAdSDKManager : NSObject
@property (nonatomic, copy, readonly, class) NSString *SDKVersion;
/**
Register the App key that’s already been applied before requesting an ad from TikTok Audience Network.
@param appID : the unique identifier of the App
*/
+ (void)setAppID:(NSString *)appID;
/**
Configure development mode.
@param level : default BUAdSDKLogLevelNone
*/
+ (void)setLoglevel:(BUAdSDKLogLevel)level;
/// Set the gender of the user.
+ (void)setUserGender:(BUUserGender)userGender;
/// Set the age of the user.
+ (void)setUserAge:(NSUInteger)userAge;
/// Set the user's keywords, such as interests and hobbies, etc.
+ (void)setUserKeywords:(NSString *)keywords;
/// set additional user information.
+ (void)setUserExtData:(NSString *)data;
/// Set whether the app is a paid app, the default is a non-paid app
+ (void)setIsPaidApp:(BOOL)isPaidApp;
+ (NSString *)appID;
+ (BOOL)isPaidApp;
@end
//
// BUAdSDKPlayableToolManager.h
// BUAdSDK
//
// Copyright © 2019 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BUAdSDKPlayableToolManager : NSObject
+ (instancetype)sharedInstance;
+ (void)setPlayableURL:(NSString *)url;
+ (void)setDownloadUrl:(NSString *)url;
+ (void)setIsLandScape:(BOOL)isLandScape;
+ (void)clearAll;
@end
//
// BUAdSlot.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BUSize.h"
typedef NS_ENUM(NSInteger, BUAdSlotAdType) {
BUAdSlotAdTypeUnknown = 0,
BUAdSlotAdTypeBanner = 1, // banner ads
BUAdSlotAdTypeInterstitial = 2, // interstitial ads
BUAdSlotAdTypeSplash = 3, // splash ads
BUAdSlotAdTypeSplash_Cache = 4, // cache splash ads
BUAdSlotAdTypeFeed = 5, // feed ads
BUAdSlotAdTypePaster = 6, // paster ads
BUAdSlotAdTypeRewardVideo = 7, // rewarded video ads
BUAdSlotAdTypeFullscreenVideo = 8, // full-screen video ads
BUAdSlotAdTypeDrawVideo = 9, // vertical (immersive) video ads
};
typedef NS_ENUM(NSInteger, BUAdSlotPosition) {
BUAdSlotPositionTop = 1,
BUAdSlotPositionBottom = 2,
BUAdSlotPositionFeed = 3,
BUAdSlotPositionMiddle = 4, // for interstitial ad only
BUAdSlotPositionFullscreen = 5,
};
@interface BUAdSlot : NSObject
/// required. The unique identifier of a native ad.
@property (nonatomic, copy) NSString *ID;
/// required. Ad type.
@property (nonatomic, assign) BUAdSlotAdType AdType;
/// required. Ad display location.
@property (nonatomic, assign) BUAdSlotPosition position;
/// Accept a set of image sizes, please pass in the BUSize object.
@property (nonatomic, strong) NSMutableArray<BUSize *> *imgSizeArray;
/// required. Image size.
@property (nonatomic, strong) BUSize *imgSize;
/// Icon size.
@property (nonatomic, strong) BUSize *iconSize;
/// Maximum length of the title.
@property (nonatomic, assign) NSInteger titleLengthLimit;
/// Maximum length of description.
@property (nonatomic, assign) NSInteger descLengthLimit;
/// Whether to support deeplink.
@property (nonatomic, assign) BOOL isSupportDeepLink;
/// Native banner ads and native interstitial ads are set to 1, other ad types are 0, the default is 0.
@property (nonatomic, assign) BOOL isOriginAd;
- (NSDictionary *)dictionaryValue;
@end
//
// BUBannerAdView.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUNativeAd.h"
@class BUDislikeWords, BUAdSlot;
@protocol BUBannerAdViewDelegate;
NS_ASSUME_NONNULL_BEGIN
@interface BUBannerAdView : UIView
@property (nonatomic, weak, nullable) id<BUBannerAdViewDelegate> delegate;
/**
The carousel interval, in seconds, is set in the range of 30~120s, and is passed during initialization. If it does not meet the requirements, it will not be in carousel ad.
*/
@property (nonatomic, assign, readonly) NSInteger interval;
/**
The dislikeButton has been added to the upper right corner of the BannerView by default, it will respond to dislike reasons.
*/
@property (nonatomic, strong, readonly, nonnull) UIButton *dislikeButton;
- (instancetype)initWithIdentifier:(NSString *)slotID
rootViewController:(UIViewController *)rootViewController
adSize:(CGSize)adSize
withShowPosition:(BUAdSlotPosition)showPosition
WithIsSupportDeepLink:(BOOL)isSupportDeepLink;
- (instancetype)initWithIdentifier:(NSString *)slotID
rootViewController:(UIViewController *)rootViewController
adSize:(CGSize)adSize
withShowPosition:(BUAdSlotPosition)showPosition
WithIsSupportDeepLink:(BOOL)isSupportDeepLink
interval:(NSInteger)interval;
- (instancetype)initWithSlotID:(NSString *)slotID
size:(BUSize *)adSize
rootViewController:(UIViewController *)rootViewController;
- (instancetype)initWithSlotID:(NSString *)slotID
size:(BUSize *)adSize
rootViewController:(UIViewController *)rootViewController
interval:(NSInteger)interval;
- (void)loadAdData;
- (IBAction)dislikeAction:(id)sender;
@end
@protocol BUBannerAdViewDelegate <NSObject>
@optional
/**
This method is called when bannerAdView ad slot loaded successfully.
@param bannerAdView : view for bannerAdView
@param nativeAd : nativeAd for bannerAdView
*/
- (void)bannerAdViewDidLoad:(BUBannerAdView *)bannerAdView WithAdmodel:(BUNativeAd *_Nullable)nativeAd;
/**
This method is called when bannerAdView ad slot failed to load.
@param error : the reason of error
*/
- (void)bannerAdView:(BUBannerAdView *)bannerAdView didLoadFailWithError:(NSError *_Nullable)error;
/**
This method is called when bannerAdView ad slot showed new ad.
*/
- (void)bannerAdViewDidBecomVisible:(BUBannerAdView *)bannerAdView WithAdmodel:(BUNativeAd *_Nullable)nativeAd;
/**
This method is called when bannerAdView is clicked.
*/
- (void)bannerAdViewDidClick:(BUBannerAdView *)bannerAdView WithAdmodel:(BUNativeAd *_Nullable)nativeAd;
/**
This method is called when the user clicked dislike button and chose dislike reasons.
@param filterwords : the array of reasons for dislike.
*/
- (void)bannerAdView:(BUBannerAdView *)bannerAdView dislikeWithReason:(NSArray<BUDislikeWords *> *_Nullable)filterwords;
/**
This method is called when another controller has been closed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)bannerAdViewDidCloseOtherController:(BUBannerAdView *)bannerAdView interactionType:(BUInteractionType)interactionType;
@end
NS_ASSUME_NONNULL_END
//
// BUDislike.h
// BUAdSDK
//
// Copyright © 2018年 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
@class BUNativeAd;
@class BUDislikeWords;
/**
!!! important :
Please report to the sdk the user’s selection, inaccurate model will result in poor ad performance.
*/
@interface BUDislike : NSObject
/**
The array of BUDislikeWords which have reasons for dislike.
The application can show the secondary page for dislike if '[filterWords.options count] > 0'.
*/
@property (nonatomic, copy, readonly) NSArray<BUDislikeWords *> *filterWords;
/**
Initialize with nativeAd to get filterWords.
return BUDislike
*/
- (instancetype)initWithNativeAd:(BUNativeAd *)nativeAd;
/**
Call this method after the user chose dislike reasons.
(Only for object which uses 'BUDislike.filterWords')
@param filterWord : reasons for dislike
@note : don't need to call this method if '[filterWords.options count] > 0'.
@note :please dont't change 'BUDislike.filterWords'.
'filterWord' must be one of 'BUDislike.filterWords', otherwise it will be filtered.
*/
- (void)didSelectedFilterWordWithReason:(BUDislikeWords *)filterWord;
@end
//
// BUDislikeWords.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BUDislikeWords : NSObject <NSCoding>
@property (nonatomic, copy, readonly) NSString *dislikeID;
@property (nonatomic, copy, readonly) NSString *name;
@property (nonatomic, assign, readonly) BOOL isSelected;
@property (nonatomic, copy,readonly) NSArray<BUDislikeWords *> *options;
- (instancetype)initWithDictionary:(NSDictionary *)dict error:(NSError **)error;
@end
//
// BUFullscreenVideoAd.h
// BUAdSDK
//
// Copyright © 2018年 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BUAdSlot.h"
NS_ASSUME_NONNULL_BEGIN
@class BUFullscreenVideoAd;
@protocol BUFullscreenVideoAdDelegate <NSObject>
@optional
/**
This method is called when video ad material loaded successfully.
*/
- (void)fullscreenVideoMaterialMetaAdDidLoad:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad materia failed to load.
@param error : the reason of error
*/
- (void)fullscreenVideoAd:(BUFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when video cached successfully.
*/
- (void)fullscreenVideoAdVideoDataDidLoad:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad slot will be showing.
*/
- (void)fullscreenVideoAdWillVisible:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad slot has been shown.
*/
- (void)fullscreenVideoAdDidVisible:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad is clicked.
*/
- (void)fullscreenVideoAdDidClick:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad is about to close.
*/
- (void)fullscreenVideoAdWillClose:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad is closed.
*/
- (void)fullscreenVideoAdDidClose:(BUFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad play completed or an error occurred.
@param error : the reason of error
*/
- (void)fullscreenVideoAdDidPlayFinish:(BUFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when the user clicked skip button.
*/
- (void)fullscreenVideoAdDidClickSkip:(BUFullscreenVideoAd *)fullscreenVideoAd;
@end
@interface BUFullscreenVideoAd : NSObject
@property (nonatomic, weak, nullable) id<BUFullscreenVideoAdDelegate> delegate;
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
/**
Initializes video ad with slot id.
@param slotID : the unique identifier of video ad.
@return BUFullscreenVideoAd
*/
- (instancetype)initWithSlotID:(NSString *)slotID;
/**
Load video ad datas.
*/
- (void)loadAdData;
/**
Display video ad.
@param rootViewController : root view controller for displaying ad.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
/**
Display video ad.
@param rootViewController : root view controller for displaying ad.
@param sceneDescirbe : optional. Identifies a custom description of the presentation scenario.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
@end
NS_ASSUME_NONNULL_END
//
// BUImage.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BUImage : NSObject <NSCoding>
// image address URL
@property (nonatomic, copy) NSString *imageURL;
// image width
@property (nonatomic, assign) float width;
// image height
@property (nonatomic, assign) float height;
- (instancetype)initWithDictionary:(NSDictionary *)dic;
@end
//
// BUInterstitialAd.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUAdSDKDefines.h"
#import "BUMaterialMeta.h"
NS_ASSUME_NONNULL_BEGIN
@class BUSize;
@protocol BUInterstitialAdDelegate;
@interface BUInterstitialAd : NSObject
@property (nonatomic, weak, nullable) id<BUInterstitialAdDelegate> delegate;
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
/**
Initializes interstitial ad.
@param slotID : The unique identifier of interstitial ad.
@param expectSize : custom size, default 600px * 400px
@return BUInterstitialAd
*/
- (instancetype)initWithSlotID:(NSString *)slotID size:(BUSize *)expectSize NS_DESIGNATED_INITIALIZER;
/**
Load interstitial ad datas.
*/
- (void)loadAdData;
/**
Display interstitial ad.
@param rootViewController : root view controller for displaying ad.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
@end
@protocol BUInterstitialAdDelegate <NSObject>
@optional
/**
This method is called when interstitial ad material loaded successfully.
*/
- (void)interstitialAdDidLoad:(BUInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad material failed to load.
@param error : the reason of error
*/
- (void)interstitialAd:(BUInterstitialAd *)interstitialAd didFailWithError:(NSError * _Nullable)error;
/**
This method is called when interstitial ad slot will be showing.
*/
- (void)interstitialAdWillVisible:(BUInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad is clicked.
*/
- (void)interstitialAdDidClick:(BUInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad is about to close.
*/
- (void)interstitialAdWillClose:(BUInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad is closed.
*/
- (void)interstitialAdDidClose:(BUInterstitialAd *)interstitialAd;
/**
This method is called when another controller has been closed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)interstitialAdDidCloseOtherController:(BUInterstitialAd *)interstitialAd interactionType:(BUInteractionType)interactionType;
@end
NS_ASSUME_NONNULL_END
//
// BUMaterialMeta.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BUDislikeWords.h"
#import "BUImage.h"
typedef NS_ENUM(NSInteger, BUInteractionType) {
BUInteractionTypeCustorm = 0,
BUInteractionTypeNO_INTERACTION = 1, // pure ad display
BUInteractionTypeURL = 2, // open the webpage using a browser
BUInteractionTypePage = 3, // open the webpage within the app
BUInteractionTypeDownload = 4, // download the app
BUInteractionTypePhone = 5, // make a call
BUInteractionTypeMessage = 6, // send messages
BUInteractionTypeEmail = 7, // send email
BUInteractionTypeVideoAdDetail = 8 // video ad details page
};
typedef NS_ENUM(NSInteger, BUFeedADMode) {
BUFeedADModeSmallImage = 2,
BUFeedADModeLargeImage = 3,
BUFeedADModeGroupImage = 4,
BUFeedVideoAdModeImage = 5, // video ad || rewarded video ad horizontal screen
BUFeedVideoAdModePortrait = 15, // rewarded video ad vertical screen
BUFeedADModeImagePortrait = 16
};
@interface BUMaterialMeta : NSObject <NSCoding>
/// interaction types supported by ads.
@property (nonatomic, assign) BUInteractionType interactionType;
/// material pictures.
@property (nonatomic, strong) NSArray<BUImage *> *imageAry;
/// ad logo icon.
@property (nonatomic, strong) BUImage *icon;
/// ad headline.
@property (nonatomic, copy) NSString *AdTitle;
/// ad description.
@property (nonatomic, copy) NSString *AdDescription;
/// ad source.
@property (nonatomic, copy) NSString *source;
/// text displayed on the creative button.
@property (nonatomic, copy) NSString *buttonText;
/// display format of the in-feed ad, other ads ignores it.
@property (nonatomic, assign) BUFeedADMode imageMode;
/// Star rating, range from 1 to 5.
@property (nonatomic, assign) NSInteger score;
/// Number of comments.
@property (nonatomic, assign) NSInteger commentNum;
/// ad installation package size, unit byte.
@property (nonatomic, assign) NSInteger appSize;
// video duration
@property (nonatomic, assign) NSInteger videoDuration;
/// media configuration parameters.
@property (nonatomic, strong) NSDictionary *mediaExt;
- (instancetype)initWithDictionary:(NSDictionary *)dict error:(NSError * __autoreleasing *)error;
@end
//
// BUNativeAd.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BUAdSlot.h"
#import "BUMaterialMeta.h"
#import "BUVideoAdView.h"
@protocol BUNativeAdDelegate;
NS_ASSUME_NONNULL_BEGIN
/**
Abstract ad slot containing ad data loading, response callbacks.
BUNativeAd currently supports native ads.
Native ads include in-feed ad (multiple ads, image + video), general native ad (single ad, image + video), native banner ad, and native interstitial ad.
Support interstitial ad, banner ad, splash ad, rewarded video ad, full-screen video ad.
*/
@interface BUNativeAd : NSObject
/**
Ad slot description.
*/
@property (nonatomic, strong, readwrite, nullable) BUAdSlot *adslot;
/**
Ad slot material.
*/
@property (nonatomic, strong, readonly, nullable) BUMaterialMeta *data;
/**
The delegate for receiving state change messages.
The delegate is not limited to viewcontroller.
The delegate can be set to any object which conforming to <BUNativeAdDelegate>.
*/
@property (nonatomic, weak, readwrite, nullable) id<BUNativeAdDelegate> delegate;
/**
required.
Root view controller for handling ad actions.
Action method includes 'pushViewController' and 'presentViewController'.
*/
@property (nonatomic, weak, readwrite) UIViewController *rootViewController;
/**
Initializes native ad with ad slot.
@param slot : ad slot description.
including slotID,adType,adPosition,etc.
@return BUNativeAd
*/
- (instancetype)initWithSlot:(BUAdSlot *)slot;
/**
Register clickable views in native ads view.
Interaction types can be configured on TikTok Audience Network.
Interaction types include view video ad details page, make a call, send email, download the app, open the webpage using a browser,open the webpage within the app, etc.
@param containerView : required.
container view of the native ad.
@param clickableViews : optional.
Array of views that are clickable.
*/
- (void)registerContainer:(__kindof UIView *)containerView
withClickableViews:(NSArray<__kindof UIView *> *_Nullable)clickableViews;
/**
Unregister ad view from the native ad.
*/
- (void)unregisterView;
/**
Actively request nativeAd datas.
*/
- (void)loadAdData;
@end
@protocol BUNativeAdDelegate <NSObject>
@optional
/**
This method is called when native ad material loaded successfully.
*/
- (void)nativeAdDidLoad:(BUNativeAd *)nativeAd;
/**
This method is called when native ad materia failed to load.
@param error : the reason of error
*/
- (void)nativeAd:(BUNativeAd *)nativeAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when native ad slot has been shown.
*/
- (void)nativeAdDidBecomeVisible:(BUNativeAd *)nativeAd;
/**
This method is called when another controller has been closed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)nativeAdDidCloseOtherController:(BUNativeAd *)nativeAd interactionType:(BUInteractionType)interactionType;
/**
This method is called when native ad is clicked.
*/
- (void)nativeAdDidClick:(BUNativeAd *)nativeAd withView:(UIView *_Nullable)view;
/**
This method is called when the user clicked dislike reasons.
Only used for dislikeButton in BUNativeAdRelatedView.h
@param filterWords : reasons for dislike
*/
- (void)nativeAd:(BUNativeAd *_Nullable)nativeAd dislikeWithReason:(NSArray<BUDislikeWords *> *_Nullable)filterWords;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeAdRelatedView.h
// BUAdSDK
//
// Copyright © 2018年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUVideoAdView.h"
#import "BUNativeAd.h"
NS_ASSUME_NONNULL_BEGIN
@interface BUNativeAdRelatedView : NSObject
/**
Need to actively add to the view in order to deal with the feedback and improve the accuracy of ad.
*/
@property (nonatomic, strong, readonly, nullable) UIButton *dislikeButton;
/**
Promotion label.Need to actively add to the view.
*/
@property (nonatomic, strong, readonly, nullable) UILabel *adLabel;
/**
Ad logo.Need to actively add to the view.
*/
@property (nonatomic, strong, readonly, nullable) UIImageView *logoImageView;
/**
Ad logo + Promotion label.Need to actively add to the view.
*/
@property (nonatomic, strong, readonly, nullable) UIImageView *logoADImageView;
/**
Video ad view. Need to actively add to the view.
*/
@property (nonatomic, strong, readonly, nullable) BUVideoAdView *videoAdView;
/**
Refresh the data every time you get new datas in order to show ad perfectly.
*/
- (void)refreshData:(BUNativeAd *)nativeAd;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeAdsManager.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
/**
BUNativeAdsManager : for multiple requests at the same time.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BUAdSlot.h"
#import "BUMaterialMeta.h"
#import "BUNativeAd.h"
@protocol BUNativeAdsManagerDelegate;
NS_ASSUME_NONNULL_BEGIN
/// Bunativeadsmanager class can request multiple ad data per time.
@interface BUNativeAdsManager : NSObject
@property (nonatomic, strong, nullable) BUAdSlot *adslot;
@property (nonatomic, strong, nullable) NSArray<BUNativeAd *> *data;
/// The delegate for receiving state change messages such as requests succeeding/failing.
/// The delegate can be set to any object which conforming to <BUNativeAdsManagerDelegate>.
@property (nonatomic, weak, nullable) id<BUNativeAdsManagerDelegate> delegate;
- (instancetype)initWithSlot:(BUAdSlot * _Nullable) slot;
/**
It is recommended to request no more than 3 ads.
The maximum is 10.
*/
- (void)loadAdDataWithCount:(NSInteger)count;
@end
@protocol BUNativeAdsManagerDelegate <NSObject>
@optional
- (void)nativeAdsManagerSuccessToLoad:(BUNativeAdsManager *)adsManager nativeAds:(NSArray<BUNativeAd *> *_Nullable)nativeAdDataArray;
- (void)nativeAdsManager:(BUNativeAdsManager *)adsManager didFailWithError:(NSError *_Nullable)error;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeExpressAdManager.h
// BUAdSDK
//
// Created by bytedance on 2019/1/20.
// Copyright © 2019年 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "BUAdSlot.h"
#import "BUNativeExpressAdView.h"
#import "BUDislikeWords.h"
NS_ASSUME_NONNULL_BEGIN
@class BUNativeExpressAdManager;
@protocol BUNativeExpressAdViewDelegate <NSObject>
@optional
/**
* Sent when views successfully load ad
*/
- (void)nativeExpressAdSuccessToLoad:(BUNativeExpressAdManager *)nativeExpressAd views:(NSArray<__kindof BUNativeExpressAdView *> *)views;
/**
* Sent when views fail to load ad
*/
- (void)nativeExpressAdFailToLoad:(BUNativeExpressAdManager *)nativeExpressAd error:(NSError *_Nullable)error;
/**
* This method is called when rendering a nativeExpressAdView successed, and nativeExpressAdView.size.height has been updated
*/
- (void)nativeExpressAdViewRenderSuccess:(BUNativeExpressAdView *)nativeExpressAdView;
/**
* This method is called when a nativeExpressAdView failed to render
*/
- (void)nativeExpressAdViewRenderFail:(BUNativeExpressAdView *)nativeExpressAdView error:(NSError *_Nullable)error;
/**
* Sent when an ad view is about to present modal content
*/
- (void)nativeExpressAdViewWillShow:(BUNativeExpressAdView *)nativeExpressAdView;
/**
* Sent when an ad view is clicked
*/
- (void)nativeExpressAdViewDidClick:(BUNativeExpressAdView *)nativeExpressAdView;
/**
* Sent when a player finished
* @param error : error of player
*/
- (void)nativeExpressAdViewPlayerDidPlayFinish:(BUNativeExpressAdView *)nativeExpressAdView error:(NSError *)error;
/**
* Sent when a user clicked dislike reasons.
* @param filterWords : the array of reasons why the user dislikes the ad
*/
- (void)nativeExpressAdView:(BUNativeExpressAdView *)nativeExpressAdView dislikeWithReason:(NSArray<BUDislikeWords *> *)filterWords;
/**
* Sent after an ad view is clicked, a ad landscape view will present modal content
*/
- (void)nativeExpressAdViewWillPresentScreen:(BUNativeExpressAdView *)nativeExpressAdView;
@end
@interface BUNativeExpressAdManager : NSObject
@property (nonatomic, strong, nullable) BUAdSlot *adslot;
@property (nonatomic, assign, readwrite) CGSize adSize;
/**
The delegate for receiving state change messages from a BUNativeExpressAdManager
*/
@property (nonatomic, weak, nullable) id<BUNativeExpressAdViewDelegate> delegate;
/**
@param size expected ad view size,when size.height is zero, acture height will match size.width
*/
- (instancetype)initWithSlot:(BUAdSlot * _Nullable)slot adSize:(CGSize)size;
/**
The number of ads requested,The maximum is 3
*/
- (void)loadAd:(NSInteger)count;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeExpressAdView.h
// BUAdSDK
//
// Created by bytedance on 2019/1/20.
// Copyright © 2019年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface BUNativeExpressAdView : UIView
/**
* Whether render is ready
*/
@property (nonatomic, assign, readonly) BOOL isReady;
/*
required.
Root view controller for handling ad actions.
*/
@property (nonatomic, weak) UIViewController *rootViewController;
/**
required
*/
- (void)render;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeExpressBannerView.h
// BUAdSDK
//
// Created by xxx on 2019/5/17.
// Copyright © 2019 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class BUNativeExpressBannerView;
@class BUDislikeWords;
@class BUSize;
@protocol BUNativeExpressBannerViewDelegate <NSObject>
@optional
/**
This method is called when bannerAdView ad slot loaded successfully.
@param bannerAdView : view for bannerAdView
*/
- (void)nativeExpressBannerAdViewDidLoad:(BUNativeExpressBannerView *)bannerAdView;
/**
This method is called when bannerAdView ad slot failed to load.
@param error : the reason of error
*/
- (void)nativeExpressBannerAdView:(BUNativeExpressBannerView *)bannerAdView didLoadFailWithError:(NSError *_Nullable)error;
/**
This method is called when rendering a nativeExpressAdView successed.
*/
- (void)nativeExpressBannerAdViewRenderSuccess:(BUNativeExpressBannerView *)bannerAdView;
/**
This method is called when a nativeExpressAdView failed to render.
@param error : the reason of error
*/
- (void)nativeExpressBannerAdViewRenderFail:(BUNativeExpressBannerView *)bannerAdView error:(NSError * __nullable)error;
/**
This method is called when bannerAdView ad slot showed new ad.
*/
- (void)nativeExpressBannerAdViewWillBecomVisible:(BUNativeExpressBannerView *)bannerAdView;
/**
This method is called when bannerAdView is clicked.
*/
- (void)nativeExpressBannerAdViewDidClick:(BUNativeExpressBannerView *)bannerAdView;
/**
This method is called when the user clicked dislike button and chose dislike reasons.
@param filterwords : the array of reasons for dislike.
*/
- (void)nativeExpressBannerAdView:(BUNativeExpressBannerView *)bannerAdView dislikeWithReason:(NSArray<BUDislikeWords *> *_Nullable)filterwords;
@end
@interface BUNativeExpressBannerView : UIView
@property (nonatomic, weak, nullable) id<BUNativeExpressBannerViewDelegate> delegate;
/**
The carousel interval, in seconds, is set in the range of 30~120s, and is passed during initialization. If it does not meet the requirements, it will not be in carousel ad.
*/
@property (nonatomic, assign, readonly) NSInteger interval;
- (instancetype)initWithSlotID:(NSString *)slotID
rootViewController:(UIViewController *)rootViewController
imgSize:(BUSize * __nullable )expectSize
adSize:(CGSize)adsize
IsSupportDeepLink:(BOOL)isSupportDeepLink;
- (instancetype)initWithSlotID:(NSString *)slotID
rootViewController:(UIViewController *)rootViewController
imgSize:(BUSize * __nullable )expectSize
adSize:(CGSize)adsize
IsSupportDeepLink:(BOOL)isSupportDeepLink
interval:(NSInteger)interval;
- (void)loadAdData;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeExpressFullscreenVideoAd.h
// BUAdSDK
//
// Copyright © 2019 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
@class BUNativeExpressFullscreenVideoAd;
NS_ASSUME_NONNULL_BEGIN
@protocol BUNativeExpressFullscreenVideoAdDelegate <NSObject>
@optional
/**
This method is called when video ad material loaded successfully.
*/
- (void)nativeExpressFullscreenVideoAdDidLoad:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad materia failed to load.
@param error : the reason of error
*/
- (void)nativeExpressFullscreenVideoAd:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when rendering a nativeExpressAdView successed.
*/
- (void)nativeExpressFullscreenVideoAdViewRenderSuccess:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd;
/**
This method is called when a nativeExpressAdView failed to render.
@param error : the reason of error
*/
- (void)nativeExpressFullscreenVideoAdViewRenderFail:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd error:(NSError *_Nullable)error;
/**
This method is called when video cached successfully.
*/
- (void)nativeExpressFullscreenVideoAdDidDownLoadVideo:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad slot will be showing.
*/
- (void)nativeExpressFullscreenVideoAdWillVisible:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad slot has been shown.
*/
- (void)nativeExpressFullscreenVideoAdDidVisible:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad is clicked.
*/
- (void)nativeExpressFullscreenVideoAdDidClick:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when the user clicked skip button.
*/
- (void)nativeExpressFullscreenVideoAdDidClickSkip:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad is about to close.
*/
- (void)nativeExpressFullscreenVideoAdWillClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad is closed.
*/
- (void)nativeExpressFullscreenVideoAdDidClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd;
/**
This method is called when video ad play completed or an error occurred.
@param error : the reason of error
*/
- (void)nativeExpressFullscreenVideoAdDidPlayFinish:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error;
@end
@interface BUNativeExpressFullscreenVideoAd : NSObject
@property (nonatomic, weak, nullable) id<BUNativeExpressFullscreenVideoAdDelegate> delegate;
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
/**
Initializes video ad with slot id.
@param slotID : the unique identifier of video ad.
@return BUFullscreenVideoAd
*/
- (instancetype)initWithSlotID:(NSString *)slotID;
/**
Load video ad datas.
*/
- (void)loadAdData;
/**
Display video ad.
@param rootViewController : root view controller for displaying ad.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
/**
Display video ad.
@param rootViewController : root view controller for displaying ad.
@param sceneDescirbe : optional. Identifies a custom description of the presentation scenario.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeExpressInterstitialAd.h
// BUAdSDK
//
// Created by xxx on 2019/5/16.
// Copyright © 2019 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class BUSize;
@class BUNativeExpressInterstitialAd;
@protocol BUNativeExpresInterstitialAdDelegate <NSObject>
@optional
/**
This method is called when interstitial ad material loaded successfully.
*/
- (void)nativeExpresInterstitialAdDidLoad:(BUNativeExpressInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad material failed to load.
@param error : the reason of error
*/
- (void)nativeExpresInterstitialAd:(BUNativeExpressInterstitialAd *)interstitialAd didFailWithError:(NSError * __nullable)error;
/**
This method is called when rendering a nativeExpressAdView successed.
*/
- (void)nativeExpresInterstitialAdRenderSuccess:(BUNativeExpressInterstitialAd *)interstitialAd;
/**
This method is called when a nativeExpressAdView failed to render.
@param error : the reason of error
*/
- (void)nativeExpresInterstitialAdRenderFail:(BUNativeExpressInterstitialAd *)interstitialAd error:(NSError * __nullable)error;
/**
This method is called when interstitial ad slot will be showing.
*/
- (void)nativeExpresInterstitialAdWillVisible:(BUNativeExpressInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad is clicked.
*/
- (void)nativeExpresInterstitialAdDidClick:(BUNativeExpressInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad is about to close.
*/
- (void)nativeExpresInterstitialAdWillClose:(BUNativeExpressInterstitialAd *)interstitialAd;
/**
This method is called when interstitial ad is closed.
*/
- (void)nativeExpresInterstitialAdDidClose:(BUNativeExpressInterstitialAd *)interstitialAd;
@end
@interface BUNativeExpressInterstitialAd : NSObject
@property (nonatomic, weak, nullable) id<BUNativeExpresInterstitialAdDelegate> delegate;
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
/**
Initializes interstitial ad.
@param slotID : The unique identifier of interstitial ad.
@param expectSize : custom size of image, default 600px * 400px.
@param adsize : custom size of ad view.
@return BUInterstitialAd
*/
- (instancetype)initWithSlotID:(NSString *)slotID imgSize:(BUSize * __nullable )expectSize adSize:(CGSize)adsize;
/**
Load interstitial ad datas.
*/
- (void)loadAdData;
/**
Display interstitial ad.
@param rootViewController : root view controller for displaying ad.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
@end
NS_ASSUME_NONNULL_END
//
// BUNativeExpressRewardedVideoAd.h
// BUAdSDK
//
// Copyright © 2019 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUAdSDKDefines.h"
@class BUNativeExpressRewardedVideoAd;
@class BURewardedVideoModel;
NS_ASSUME_NONNULL_BEGIN
@protocol BUNativeExpressRewardedVideoAdDelegate <NSObject>
@optional
/**
This method is called when video ad material loaded successfully.
*/
- (void)nativeExpressRewardedVideoAdDidLoad:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad materia failed to load.
@param error : the reason of error
*/
- (void)nativeExpressRewardedVideoAd:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when cached successfully.
*/
- (void)nativeExpressRewardedVideoAdDidDownLoadVideo:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when rendering a nativeExpressAdView successed.
*/
- (void)nativeExpressRewardedVideoAdViewRenderSuccess:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when a nativeExpressAdView failed to render.
@param error : the reason of error
*/
- (void)nativeExpressRewardedVideoAdViewRenderFail:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd error:(NSError *_Nullable)error;
/**
This method is called when video ad slot will be showing.
*/
- (void)nativeExpressRewardedVideoAdWillVisible:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad slot has been shown.
*/
- (void)nativeExpressRewardedVideoAdDidVisible:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad is about to close.
*/
- (void)nativeExpressRewardedVideoAdWillClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad is closed.
*/
- (void)nativeExpressRewardedVideoAdDidClose:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad is clicked.
*/
- (void)nativeExpressRewardedVideoAdDidClick:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when the user clicked skip button.
*/
- (void)nativeExpressRewardedVideoAdDidClickSkip:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad play completed or an error occurred.
@param error : the reason of error
*/
- (void)nativeExpressRewardedVideoAdDidPlayFinish:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error;
/**
Server verification which is requested asynchronously is succeeded.
@param verify :return YES when return value is 2000.
*/
- (void)nativeExpressRewardedVideoAdServerRewardDidSucceed:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd verify:(BOOL)verify;
/**
Server verification which is requested asynchronously is failed.
Return value is not 2000.
*/
- (void)nativeExpressRewardedVideoAdServerRewardDidFail:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd;
@end
@interface BUNativeExpressRewardedVideoAd : NSObject
@property (nonatomic, strong) BURewardedVideoModel *rewardedVideoModel;
@property (nonatomic, weak, nullable) id<BUNativeExpressRewardedVideoAdDelegate> delegate;
/**
Whether material is effective.
Setted to YES when data is not empty and has not been displayed.
Repeated display is not billed.
*/
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
- (instancetype)initWithSlotID:(NSString *)slotID rewardedVideoModel:(BURewardedVideoModel *)model;
- (void)loadAdData;
/**
Display video ad.
@param rootViewController : root view controller for displaying ad.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
/**
If ritSceneType is custom, you need to pass in the values for sceneDescirbe.
@param ritSceneType : optional. Identifies a custom description of the presentation scenario.
@param sceneDescirbe : optional. Identify the scene of presentation.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritScene:(BURitSceneType)ritSceneType ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
@end
NS_ASSUME_NONNULL_END
//
// BUPlayerPublicDefine.h
// BUAdSDK
//
// Copyright © 2018年 bytedance. All rights reserved.
//
#ifndef BUPlayerPublicDefine_h
#define BUPlayerPublicDefine_h
typedef NS_ENUM(NSInteger, BUPlayerPlayState) {
BUPlayerStateFailed = 0,
BUPlayerStateBuffering = 1,
BUPlayerStatePlaying = 2,
BUPlayerStateStopped = 3,
BUPlayerStatePause = 4,
BUPlayerStateDefalt = 5
};
@class BUPlayer;
@protocol BUPlayerDelegate <NSObject>
@optional
/**
This method is called when the player status changes.
*/
- (void)player:(BUPlayer *)player stateDidChanged:(BUPlayerPlayState)playerState;
/**
This method is called when the player is ready.
*/
- (void)playerReadyToPlay:(BUPlayer *)player;
/**
This method is called when the player plays completion or occurrs error.
*/
- (void)playerDidPlayFinish:(BUPlayer *)player error:(NSError *)error;
/**
This method is called when the player is clicked.
*/
- (void)player:(BUPlayer *)player recognizeTapGesture:(UITapGestureRecognizer *)gesture;
/**
This method is called when the view is clicked during ad play.
*/
- (void)playerTouchesBegan:(BUPlayer *)player;
@end
#endif /* BUPlayerPublicDefine_h */
//
// BURewardedVideoAd.h
// BUAdSDK
//
// Copyright © 2018年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUAdSDKDefines.h"
NS_ASSUME_NONNULL_BEGIN
@protocol BURewardedVideoAdDelegate;
@class BURewardedVideoModel;
@interface BURewardedVideoAd : NSObject
@property (nonatomic, strong) BURewardedVideoModel *rewardedVideoModel;
@property (nonatomic, weak, nullable) id<BURewardedVideoAdDelegate> delegate;
/**
Whether material is effective.
Setted to YES when data is not empty and has not been displayed.
Repeated display is not billed.
*/
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
- (instancetype)initWithSlotID:(NSString *)slotID rewardedVideoModel:(BURewardedVideoModel *)model;
- (void)loadAdData;
/**
Display video ad.
@param rootViewController : root view controller for displaying ad.
@return : whether it is successfully displayed.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController;
/**
If ritSceneType is custom, you need to pass in the values for sceneDescirbe.
@param ritSceneType : optional. Identifies a custom description of the presentation scenario.
@param sceneDescirbe : optional. Identify the scene of presentation.
*/
- (BOOL)showAdFromRootViewController:(UIViewController *)rootViewController ritScene:(BURitSceneType)ritSceneType ritSceneDescribe:(NSString *_Nullable)sceneDescirbe;
@end
@protocol BURewardedVideoAdDelegate <NSObject>
@optional
/**
This method is called when video ad material loaded successfully.
*/
- (void)rewardedVideoAdDidLoad:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad materia failed to load.
@param error : the reason of error
*/
- (void)rewardedVideoAd:(BURewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when cached successfully.
*/
- (void)rewardedVideoAdVideoDidLoad:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad slot will be showing.
*/
- (void)rewardedVideoAdWillVisible:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad slot has been shown.
*/
- (void)rewardedVideoAdDidVisible:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad is about to close.
*/
- (void)rewardedVideoAdWillClose:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad is closed.
*/
- (void)rewardedVideoAdDidClose:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad is clicked.
*/
- (void)rewardedVideoAdDidClick:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when video ad play completed or an error occurred.
@param error : the reason of error
*/
- (void)rewardedVideoAdDidPlayFinish:(BURewardedVideoAd *)rewardedVideoAd didFailWithError:(NSError *_Nullable)error;
/**
Server verification which is requested asynchronously is succeeded.
@param verify :return YES when return value is 2000.
*/
- (void)rewardedVideoAdServerRewardDidSucceed:(BURewardedVideoAd *)rewardedVideoAd verify:(BOOL)verify;
/**
Server verification which is requested asynchronously is failed.
Return value is not 2000.
*/
- (void)rewardedVideoAdServerRewardDidFail:(BURewardedVideoAd *)rewardedVideoAd;
/**
This method is called when the user clicked skip button.
*/
- (void)rewardedVideoAdDidClickSkip:(BURewardedVideoAd *)rewardedVideoAd;
@end
NS_ASSUME_NONNULL_END
//
// BURewardedVideoModel.h
// BUAdSDK
//
// Copyright © 2018年 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface BURewardedVideoModel : NSObject
/**
required.
Third-party game user_id identity.
Mainly used in the reward issuance, it is the callback pass-through parameter from server-to-server.
It is the unique identifier of each user.
In the non-server callback mode, it will also be pass-through when the video is finished playing.
Only the string can be passed in this case, not nil.
*/
@property (nonatomic, copy) NSString *userId;
//optional. reward name.
@property (nonatomic, copy) NSString *rewardName;
//optional. number of rewards.
@property (nonatomic, assign) NSInteger rewardAmount;
//optional. serialized string.
@property (nonatomic, copy) NSString *extra;
@end
//
// BUSize.h
// BUAdSDK
//
// Copyright © 2017 bytedance. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
Get the view with the best results by using the predefined size in pixels.
When it comes to view display, it is recommended to use the same scaling.
*/
typedef NS_ENUM(NSInteger, BUProposalSize) {
BUProposalSize_Banner600_90,
BUProposalSize_Banner600_100,
BUProposalSize_Banner600_150,
BUProposalSize_Banner600_260,
BUProposalSize_Banner600_286,
BUProposalSize_Banner600_300,
BUProposalSize_Banner600_388,
BUProposalSize_Banner600_400,
BUProposalSize_Banner600_500,
BUProposalSize_Feed228_150,
BUProposalSize_Feed690_388,
BUProposalSize_Interstitial600_400,
BUProposalSize_Interstitial600_600,
BUProposalSize_Interstitial600_900,
BUProposalSize_DrawFullScreen
};
@interface BUSize : NSObject
// width unit pixel.
@property (nonatomic, assign) NSInteger width;
// height unit pixel.
@property (nonatomic, assign) NSInteger height;
- (NSDictionary *)dictionaryValue;
@end
@interface BUSize (BU_SizeFactory)
+ (instancetype)sizeBy:(BUProposalSize)proposalSize;
@end
//
// BUSplashAdView.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUMaterialMeta.h"
NS_ASSUME_NONNULL_BEGIN
@protocol BUSplashAdDelegate;
@interface BUSplashAdView : UIView
/**
The unique identifier of splash ad.
*/
@property (nonatomic, copy, readonly, nonnull) NSString *slotID;
/**
Maximum allowable load timeout, default 3s, unit s.
*/
@property (nonatomic, assign) NSTimeInterval tolerateTimeout;
/**
Whether hide skip button, default NO.
If you hide the skip button, you need to customize the countdown.
*/
@property (nonatomic, assign) BOOL hideSkipButton;
/**
The delegate for receiving state change messages.
*/
@property (nonatomic, weak, nullable) id<BUSplashAdDelegate> delegate;
/*
required.
Root view controller for handling ad actions.
*/
@property (nonatomic, weak) UIViewController *rootViewController;
/**
Whether the splash ad data has been loaded.
*/
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
/**
Initializes splash ad with slot id and frame.
@param slotID : the unique identifier of splash ad
@param frame : the frame of splashAd view. It is recommended for the mobile phone screen.
@return BUSplashAdView
*/
- (instancetype)initWithSlotID:(NSString *)slotID frame:(CGRect)frame;
/**
Load splash ad datas.
Start the countdown(@tolerateTimeout) as soon as you request datas.
*/
- (void)loadAdData;
@end
@protocol BUSplashAdDelegate <NSObject>
@optional
/**
This method is called when splash ad material loaded successfully.
*/
- (void)splashAdDidLoad:(BUSplashAdView *)splashAd;
/**
This method is called when splash ad material failed to load.
@param error : the reason of error
*/
- (void)splashAd:(BUSplashAdView *)splashAd didFailWithError:(NSError * _Nullable)error;
/**
This method is called when splash ad slot will be showing.
*/
- (void)splashAdWillVisible:(BUSplashAdView *)splashAd;
/**
This method is called when splash ad is clicked.
*/
- (void)splashAdDidClick:(BUSplashAdView *)splashAd;
/**
This method is called when splash ad is closed.
*/
- (void)splashAdDidClose:(BUSplashAdView *)splashAd;
/**
This method is called when splash ad is about to close.
*/
- (void)splashAdWillClose:(BUSplashAdView *)splashAd;
/**
This method is called when another controller has been closed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)splashAdDidCloseOtherController:(BUSplashAdView *)splashAd interactionType:(BUInteractionType)interactionType;
@end
NS_ASSUME_NONNULL_END
//
// BUVideoAdView.h
// BUAdSDK
//
// Copyright © 2017年 bytedance. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BUPlayerPublicDefine.h"
#import "BUMaterialMeta.h"
@class BUMaterialMeta;
NS_ASSUME_NONNULL_BEGIN
/**
Control TikTok Audience Network video player.
*/
@protocol BUVideoEngine <NSObject>
/**
Get the already played time.
*/
- (CGFloat)currentPlayTime;
@end
@protocol BUVideoAdViewDelegate;
@interface BUVideoAdView : UIView<BUPlayerDelegate, BUVideoEngine>
@property (nonatomic, weak, nullable) id<BUVideoAdViewDelegate> delegate;
/// required. Root view controller for handling ad actions.
@property (nonatomic, weak, readwrite) UIViewController *rootViewController;
/**
Whether to allow pausing the video by clicking, default NO. Only for draw video(vertical video ads).
**/
@property (nonatomic, assign) BOOL drawVideoClickEnable;
/**
material information.
*/
@property (nonatomic, strong, readwrite, nullable) BUMaterialMeta *materialMeta;
- (instancetype)initWithMaterial:(BUMaterialMeta *)materialMeta;
/**
Resume to the corresponding time.
*/
- (void)playerSeekToTime:(CGFloat)time;
/**
Support configuration for pause button.
@param playImg : the image of the button
@param playSize : the size of the button. Set as cgsizezero to use default icon size.
*/
- (void)playerPlayIncon:(UIImage *)playImg playInconSize:(CGSize)playSize;
@end
@protocol BUVideoAdViewDelegate <NSObject>
@optional
/**
This method is called when videoadview failed to play.
@param error : the reason of error
*/
- (void)videoAdView:(BUVideoAdView *)videoAdView didLoadFailWithError:(NSError *_Nullable)error;
/**
This method is called when videoadview playback status changed.
@param playerState : player state after changed
*/
- (void)videoAdView:(BUVideoAdView *)videoAdView stateDidChanged:(BUPlayerPlayState)playerState;
/**
This method is called when videoadview end of play.
*/
- (void)playerDidPlayFinish:(BUVideoAdView *)videoAdView;
/**
This method is called when videoadview is clicked.
*/
- (void)videoAdViewDidClick:(BUVideoAdView *)videoAdView;
/**
This method is called when videoadview's finish view is clicked.
*/
- (void)videoAdViewFinishViewDidClick:(BUVideoAdView *)videoAdView;
/**
This method is called when another controller has been closed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)videoAdViewDidCloseOtherController:(BUVideoAdView *)videoAdView interactionType:(BUInteractionType)interactionType;
@end
NS_ASSUME_NONNULL_END
MIT License
Copyright (c) 2018 Bytedance Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# Bytedance-UnionAD
## How To Get Started
+ [Download Bytedance-UnionAD](https://github.com/bytedance/Bytedance-UnionAD/tree/master) and try out the included [example app](https://github.com/bytedance/Bytedance-UnionAD/tree/master/Example)
+ Check out the [documentation](https://github.com/bytedance/Bytedance-UnionAD/blob/master/Bytedance-UnionAd/Document/UnioniOSSDK.md) for a comprehensive look at all of the APIs available in Bytedance-UnionAD
+ If you have other questions, please read [FAQ](https://github.com/bytedance/Bytedance-UnionAD/blob/master/Bytedance-UnionAd/Document/UnioniOSSDK.md#faq) first
## Installation with CocoaPods
[CocoaPods](https://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like Bytedance-UnionAD in your projects. You can install it with the following command:
```ruby
$ gem install cocoapods
```
### Podfile
To integrate Bytedance-UnionAD into your Xcode project using CocoaPods, specify it in your **Podfile**:
```ruby
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
target 'TargetName' do
pod 'Bytedance-UnionAD'
end
```
Then, run the following command:
```ruby
$ pod install
```
Pod access is only supported after **version 1982**
If you want to get Bytedance-UnionAD before version 1982 ,Please go to [union](http://ad.toutiao.com/union/media) for more information.
## Author
Siwant
## License
Bytedance-UnionAD is available under the MIT license. See the LICENSE file for more info.
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1100"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForAnalyzing = "YES"
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33E446FE13F6C3D06F866D1D9AA26708"
BuildableName = "Bytedance-UnionAD"
BlueprintName = "Bytedance-UnionAD"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
buildConfiguration = "Debug"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment