KSNativeAd.h
2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
//
// KSNativeAd.h
// KSAdSDK
//
// Created by 徐志军 on 2019/10/11.
// Copyright © 2019 KuaiShou. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "KSMaterialMeta.h"
#import "KSAd.h"
NS_ASSUME_NONNULL_BEGIN
@protocol KSNativeAdDelegate;
@interface KSNativeAd : KSAd
/**
Ad material.
*/
@property (nonatomic, strong, readonly, nullable) KSMaterialMeta *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 <KSNativeAdDelegate>.
*/
@property (nonatomic, weak, readwrite, nullable) id<KSNativeAdDelegate> delegate;
/**
required.
Root view controller for handling ad actions.
Action method includes 'pushViewController' and 'presentViewController'.
*/
@property (nonatomic, weak, readwrite) UIViewController *rootViewController;
/**
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;
- (id)initWithPosId:(NSString *)posId;
/**
Actively request nativeAd datas.
*/
- (void)loadAdData;
/**
Actively json nativeAd datas.
*/
- (void)loadAdDataWithDictionary:(NSDictionary *)dictionary;
//- (void)reset;
- (void)reportVideoStartPlay;
- (void)reportVideoEndPlay;
@end
@protocol KSNativeAdDelegate <NSObject>
@optional
/**
This method is called when native ad material loaded successfully.
*/
- (void)nativeAdDidLoad:(KSNativeAd *)nativeAd;
/**
This method is called when native ad materia failed to load.
@param error : the reason of error
*/
- (void)nativeAd:(KSNativeAd *)nativeAd didFailWithError:(NSError *_Nullable)error;
/**
This method is called when native ad slot has been shown.
*/
- (void)nativeAdDidBecomeVisible:(KSNativeAd *)nativeAd;
/**
This method is called when native ad is clicked.
*/
- (void)nativeAdDidClick:(KSNativeAd *)nativeAd withView:(UIView *_Nullable)view;
/**
This method is called when another controller has been showed.
@param interactionType : open appstore in app or open the webpage or view video ad details page.
*/
- (void)nativeAdDidShowOtherController:(KSNativeAd *)nativeAd interactionType:(KSAdInteractionType)interactionType;
/**
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:(KSNativeAd *)nativeAd interactionType:(KSAdInteractionType)interactionType;
@end
NS_ASSUME_NONNULL_END