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.
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 Use onAdReady: instead. /*! @function onAdReady: @abstract Called when an ad is loaded via invocation of loadAd()/cacheAd() API's. loadAd() will show the ad immediately whereas cacheAd readies it & requires showAd() to show. @param adView, VMaxAdView. The ad view which sent this event. */ - (void)onAdReady:(VMaxAdView *)adView; Deprecated: - (void)adView:(VMaxAdView *)theAdView didFailedToLoadAd:(NSError *)error; Use onAdError:error: instead. /*! @function onAdError:error: @abstract Called when the ad view fails to load an ad. @param adView, VMaxAdView. The ad view which sent this event. @param error, NSError. The error which occurred. */ - (void)onAdError:(VMaxAdView *)adView error:(NSError *)error; Deprecated: - (void)willDismissAd:(VMaxAdView *)theAdView; Use onAdDismissed: instead. /*! @function onAdDismissed: @abstract Called when an ad is about to be unloaded from the view. @param adView, VMaxAdView. The ad view which sent this event. */ - (void)onAdDismissed:(VMaxAdView *)adView; Deprecated: - (void)willDismissAd:(VMaxAdView *)theAdView completed:(BOOL)completed watchedDuration:(float)watchedDuration totalDuration:(float)totalDuration; Use onAdEnd:completed:reward: instead. /*! @function onAdEnd:completed: @abstract Called when video ad viewing is completed. @param adView, VMaxAdView. The ad view which sent this event. @param completed, BOOL. Video was watched to completion or not. @param reward, NSInteger. Reward on ad completion. */ - (void)onAdEnd:(VMaxAdView *)adView completed:(BOOL)completed reward:(NSInteger)reward; @optional Deprecated: - (void)willPresentAd:(VMaxAdView *)theAdView; Use onAdStarted: instead. /*! @function onAdStarted: @abstract Called when an ad is about to be presented in the view. @param adView, VMaxAdView. The ad view which sent this event. */ - (void)onAdStarted:(VMaxAdView *)adView; Deprecated: - (void)didInteractWithAd:(VMaxAdView *)theAdView; Use onAdInteracted: instead. /*! @function onAdInteracted: @abstract Called when user interacts with an ad via click. @param adView, VMaxAdView. The ad view which sent this event. */ - (void)onAdInteracted:(VMaxAdView *)adView; Deprecated: - (void)willLeaveApp:(VMaxAdView *)theAdView; Use onAdLeftApplication: instead. /*! @function onAdLeftApplication: @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; Use onAdExpand 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; Use onAdCollapsed: 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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
typedef NS_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:
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.
1 2 3 |
// properties CGSize admobNativeExpressAdSize; // pass a CGSize for requesting native Admob express ads float adScale; // specify a scale between 50-150 (%) for scaling Billboard ads. Refer Billboard section for more info. |
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.
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 |
extern NSString* const kVMaxAdErrorDomain; extern NSString* const kVMaxAdErrorMessage; extern NSString* const kVMaxAdErrorDetail; extern NSString* const kVMaxAdErrorDetailNoFill; extern NSString* const kVMaxAdErrorDetailAdRequestNotAllowed; extern NSString* const kVMaxAdErrorDetailSDKInitFailed; extern NSString* const kVMaxAdErrorDetailNetworkError; extern NSString* const kVMaxAdErrorDetailAdParamsMissing; extern NSString* const kVMaxAdErrorDetailRenditionError; extern NSString* const kVMaxAdErrorDetailParsingFailed; extern NSString* const kVMaxAdErrorDetailUnknownError; extern NSString* const kVMaxAdErrorDetailAdExpired; typedef NS_ENUM (NSInteger, ErrorCode) { kVMaxAdErrorNoFill = 1001, kVMaxAdErrorAdRequestNotAllowed = 1002, kVMaxAdErrorPermissionsMissing = 1003, kVMaxAdErrorTimeout = 1004, kVMaxAdErrorInternalServerError = 1005, kVMaxAdErrorSDKInitFailed = 1006, kVMaxAdErrorAdMismatch = 1007, kVMaxAdErrorNetworkError = 1008, kVMaxAdErrorAdParamsMissing = 1009, kVMaxAdErrorAdRenditionFailed = 1010, kVMaxAdErrorAdParsingFailed = 1011, kVMaxAdErrorUnknownError = 1012, kVMaxAdErrorInvalidAdRequest = 1013, kVMaxAdErrorAdExpired = 1014 }; // example usage - (void)onAdError:(VMaxAdView *)adView error:(NSError *)error { VMaxAdError *err = (VMaxAdError*)error; NSLog(@"code: %ld, title: %@, description: %@", (long)err.code, err.errorTitle, err.localizedDescription) } |
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.
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 |
extern NSString* const kVMaxAdPartner_AdColony; extern NSString* const kVMaxAdPartner_Chartboost; extern NSString* const kVMaxAdPartner_Facebook; extern NSString* const kVMaxAdPartner_Flurry; extern NSString* const kVMaxAdPartner_AdX; extern NSString* const kVMaxAdPartner_Admob; extern NSString* const kVMaxAdPartner_GoogleIMA; extern NSString* const kVMaxAdPartner_MilennialMedia; extern NSString* const kVMaxAdPartner_Pokkt; extern NSString* const kVMaxAdPartner_InMobi; extern NSString* const kVMaxAdPartner_UnityAds; extern NSString* const kVMaxAdPartner_Tapjoy; extern NSString* const kVMaxAdPartner_Vungle; extern NSString* const kVMaxAdPartner_VMAX; // example usage - (void)onAdReady:(VMaxAdView *)theAdView { if(theAdView.adPartner) { NSLog(@"partner name: %@, version: %@", theAdView.adPartner.partnerName, theAdView.adPartner.partnerSDKVersion); } } Output: partner name: VMAX, version: 3.6.0 |
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.
1 2 3 4 5 6 7 8 |
// example usage VMaxAdImage *coverImage = self.nativeAd.imageMain; [coverImage loadImageAsyncWithBlock:^(UIImage *image) { if (image) { [weakSelf.getNativeAd sizeImage:image toView:weakSelf.coverImageView]; } }]; |
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.
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; [self addSubview:self.mediaView]; [self.mediaView setFrame:self.mainImgView.frame]; [self bringSubviewToFront: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
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.
Deprecations
The following classes & protocols are now obsolete.
- VMaxWallet (complete)
- VMaxWalletElement (complete)
- VMaxRewardedVideo (complete)
- VMaxRewardedVideoDelegate (complete)
- VMaxAdView
- -(void)setAdSettings:(NSDictionary*)adSettings; // use the VMaxAdSettings property instead
Note
- You must now conform to the VMaxAdDelegate to be notified for rewarded video completion & gratification of reward.
- You must now conform to the VMaxAdSDKDelegate to be notified for rewarded interstitial gratification.
See the documentation on Rewarded Interstitial Ads for more information.