Upgrade Guide for VMAX iOS SDK 3.6

Maaf, entri ini hanya tersedia dalam bahasa English. For the sake of viewer convenience, the content is shown below in the alternative language. You may click the link to switch the active language.

Older VMAX iOS SDK versions (prior to 3.6.0) will be deprecated soon. You are requested to upgrade to version 3.6.0 at the earliest to continue using VMAX in your apps.Note: Your account key is displayed on the VMAX Control Panel in User Settings.

What’s new?

VMaxAdDelegate

VMaxAdDelegate has been completely updated, simplifying the protocol adoption for all formats, including the deprecated VMaxRewardedVideoDelegate as well as individual native ad format delegates.

Objective C

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

118

119

120

121

122

123

124

125

126

127

128

129

/*!

@protocol VMaxAdDelegate

@abstract Delegate methods called by VMaxAdView class on events.

*/

@protocol VMaxAdDelegate

@required

Deprecated:

-(void)adViewDidLoadAd:(VMaxAdView *)adView

-(void)adViewDidCacheAd:(VMaxAdView *)adView

UseonAdReady:instead.

/*!

@function onAdReady:

@abstract Called when an ad is loaded via invocation of loadAd()/cacheAd() API's.

@abstract Called when an ad click by user will open another app, sending the current

application to background.

@param adView, VMaxAdView. The ad view which sent this event.

*/

-(void)onAdLeftApplication:(VMaxAdView *)adView;

Deprecated:

-(void)adViewDidExpand:(VMaxAdView *)theAdView;

UseonAdExpand instead.

/*!

@function onAdExpand:

@abstract Called when an ad view transitions to an expanded state.

Example: On clicking a banner, if an interstitial is displayed.

@param adView, VMaxAdView. The ad view which sent this event.

*/

-(void)onAdExpand:(VMaxAdView *)adView;

Deprecated:

-(void)adViewDidCollapse:(VMaxAdView *)theAdView;

UseonAdCollapsed:instead.

/*!

@function onAdCollapsed:

@abstract Called when an ad view transitions back to a normal state.

@param adView, VMaxAdView. The ad view which sent this event.

*/

-(void)onAdCollapsed:(VMaxAdView *)adView;

/*!

@function onAdInterrupted:

@abstract Called when video ad viewing is interrupted.

@param adView, VMaxAdView. The ad view which sent this event.

*/

-(void)onAdInterrupted:(VMaxAdView *)adView;

/**

@abstract The VMaxAdSDKDelegate which notifies on completion of conversions.

@discussion This method must be implemented in order to be notified of reward on conversion.

@param reward, The reward to be given.

*/

-(void)onAdReward:(NSInteger)reward;// A VMaxAdSDKDelegate, refer rewarded interstitials for more information

VMaxAdView Ad States

Corresponding with the delegate as mentioned above, you can now check for the ad state which now will be set to one of the following possible values depending on the ad lifecycle:

Objective C

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

typedefNS_ENUM(NSUInteger,VMaxAdState){

kVMaxAdState_Ad_Not_Requested,

kVMaxAdState_Ad_Ready,

kVMaxAdState_Ad_Error,

kVMaxAdState_Ad_Started,

kVMaxAdState_Ad_End,

kVMaxAdState_Ad_Dismissed,

kVMaxAdState_Ad_Expand,

kVMaxAdState_Ad_Collapsed,

kVMaxAdState_Ad_Paused,

kVMaxAdState_Ad_Resumed,

kVMaxAdState_Ad_Interacted,

kVMaxAdState_Ad_Interrupted

};

You can query for the ad state by using the getAdState api on the adview as illustrated in the example below:

Objective C

1

2

3

4

if(adView.getAdState==kVMaxAdState_Ad_Ready){

// ad is cached and ready to be shown

[adView showAd];

}

VMaxAdSettings

The newly introduced VMaxAdSettings class replaces the formerly used adSettings dictionary property on VMaxAdView. You can now set the scale for billboard ad scaling as well as specify native ad size for native Admob Express Ads.

VMaxAdError

The newly introduced VMaxAdError class aims to provide detailed diagnosis for error situations in the ad lifecycle, allowing developers to gracefully handle such situations. VMaxAdError being a subclass of the standard NSError class, you can query for the error code and localizedDescription as you would do normally with an instance of NSError. In addition to this, you can now query for a title should you wish to display it to a user. Below are the possible values.

VMaxAdPartner

The newly introduced VMaxAdPartner class aims to provide information about the ad sources. This is helpful in identifying ad sources during ad delivery as well as erroneous situations. You can query for the partner name and partner SDK version for more information through the adPartner property on VMaxAdView.

VMaxNativeAd

Image sizing

The VMaxNativeAd class now has a new instance api that is beneficial to correctly display images in native ads, especially in non-helper implementations wherein it is possible that the images do not follow IAB standards for size.
Use the sizeImage:toView api in order to size an image by maintaining aspect ratio in the container. It is required to fetch the image which can be done using the loadImageAsyncWithBlock api on the required VMaxAdImage property (main/medium) of the native ad or via some other networking mechanism.

VMaxNativeAdDelegate – onNativeAdReady

The onNativeAdReady delegate has been introduced to notify of the ready-ness of the native ad when using the native helper libs. All the helper libs now conform to the VMaxNativeAdDelegate, unlike versions prior to 3.6.0. Implement this delegate to be notified of when the helper native ad is ready to display.

VMaxMediaView

Autoplay, Mute, Play/Pause

When using the non-helper approach for displaying native ads, you can now play & pause media content of the ad by using the play/pause apis. Further you can set the autoplay & mute properties as well as illustrated below.

Objective C

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

//... prepare native ad layout by native ad elements available

//...

//...

// example usage

if(nativeAd.getVastVideoTag){

// init a mediaView object on successful ad fetch, using the nativeAd object

self.mediaView=[[VMaxMediaView alloc]initWithVMaxNativeAd:nativeAd];

self.mediaView.delegate=self;

self.mediaView.muted=NO;

self.mediaView.autoplay=NO;

[selfaddSubview:self.mediaView];

[self.mediaView setFrame:self.mainImgView.frame];

[selfbringSubviewToFront:self.mediaView];

// sometime later when the native ad is displayed

[self.mediaView play];

}

VMaxMediaViewDelegate

VMaxMediaViewDelegate has been updated to provide useful playback level notifications through new delegates. Comform to this protocol to handle special states during ad playback

Objective C

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

@optional

/*!

@function mediaViewDidStart:

@abstract This method will be called when the mediaview playback starts.

@param mediaView, VMaxMediaView. The mediaview view which sent this event.

*/

-(void)mediaViewDidStart:(VMaxMediaView *)mediaView;

/*!

@function mediaViewDidPause:

@abstract This method will be called when the mediaview playback pauses.

@param mediaView, VMaxMediaView. The mediaview view which sent this event.

*/

-(void)mediaViewDidPause:(VMaxMediaView *)mediaView;

/*!

@function mediaViewDidResume:

@abstract This method will be called when the mediaview playback resumes.

@param mediaView, VMaxMediaView. The mediaview view which sent this event.

*/

-(void)mediaViewDidResume:(VMaxMediaView *)mediaView;

/*!

@function mediaViewDidComplete:

@abstract This method will be called when the mediaview playback completes.

@param mediaView, VMaxMediaView. The mediaview view which sent this event.

*/

-(void)mediaViewDidComplete:(VMaxMediaView *)mediaView;

@end

UX for Billboard ads

VMAX SDK 3.6.0 now has the UX type kVMaxAdUX_Billboard for requesting billboard ads. kVMaxAdUX_IN_Line_Display is now deprecated.

UX for In-Stream ads

VMAX SDK 3.6.0 now has the UX type kVMaxAdUX_InStreamVideo for requesting the in-stream ads; formerly classified as In-Content Video. kVMaxAdUX_InContentVideo is now deprecated.