Banner starts to be loaded
404 Not Found
iOS Unity
1、Overview
1.1 Target Readers
This document is for developers who need to integrate ZPLAY Ads Unity 3D SDK into their Unity3D product.
1.2 Development Enviroment
Xcode 7.0 and above
Deployment target: iOS 7.0 or higher
2、SDK Download
2.1Choose third-party SDK
2.2Download ZPLAY Ads SDK
Please download ZPLAY Ads SDK and add it to your project.
DownLoad SDK v2.0.52.3Download third-party SDK
Please download third-party SDK and add it to your project according to instructions of the third-party platform
3、Development Environment Configuration
3.1 Import Files
Double click AdsYUMIUnity.unitypackage to import all the files into Unity project.
3.2 Drag Script into Scene
Relate AdsYuMiUnity.prefab to the scene that you need to use.
3.3 Import ZPLAY Ads SDK
Right click on”YUMISample”, select Add Files to” YUMISample”.
Click “Options”button and select”Copy items if needed” check box.
3.4 Configure ATS
Starting from July 2017, Apple App Store will require that all submitted apps to use ATS. You need to switch off the NSAllowsArbitraryLoads switch to enable the ATS verification. After this, all HTTP requests will be shielded.
You can switch on NSAllowsArbitraryLoads if your submitted app does not need the ATS verification. However, you need to state your reason for not using ATS when submitting your game to Apple App Store for approval.
3.5 Permission for iOS 9 and newer versions
When you submit applications to App Store, please add the following permission to info.plist.
<!-- calendar -->
<key>NSCalendarsUsageDescription</key>
<string>App needs your permission to visit calendar</string>
<!-- album -->
<key>NSPhotoLibraryUsageDescription</key>
<string>App needs your permission to visit album</string>
4、Integration
4.1 Banner
4.1.1 Initialize Banner
//adtype banner ad size public enum AdViewYMType{ AdViewYMTypeNormalBanner = 1, // iphone banner 320*50 AdViewYMTypeLargeBanner = 2, // ipad only 728*90 } //yumiKey YUMI ID ,you need to create a YUMI ID on ZPLAY Ads platform. //isStop If you are using ZPLAY Ads only, in order to ensure ad performance, please enable ZPLAY Ads rotation and set the field as 'NO'. If you are using ZPLAY Ads in other mediations, in order to ensure ad performance, please disenable ZPLAY Ads rotation and set the field as 'YES'. //isAutoAdSize Automatic adaptation to screen size, YES: enable, NO: disable. public static void initOfficialAdsYuMiView(AdViewYMType adtype, string yumiKey,bool isStop,bool isAutoAdSize){}
Sample:
AdsYuMiUnity.initOfficialAdsYuMiView(AdsYuMiUnity.AdViewYMType.AdViewYMTypeNormalBanner," YUMI ID ",false,true);
4.1.2 Show Banner
// Banner will be shown automatically after successful initialization
4.1.3 Banner Callbacks
-
adYuMiDidStartAdEvent
-
adYuMiDidReceiveAdEvent
Banner is shown successfully
-
adYuMiDidFailToReceiveAdEvent
Banner fails to be received
-
adYuMiClickAdEvent
Banner is clicked
-
adYuMiDeleteAdEvent
Banner is removed
Sample
// Start requesting void adYuMiDidStartAdEvent() { } // Request succeeds void adYuMiDidReceiveAdEvent() { } // Request fails void adYuMiDidFailToReceiveAdEvent(string error) { } // Banner is clicked void adYuMiClickAdEvent() { } // Banner is removed void adYuMiDeleteAdEvent() { }
4.2 Interstitial
4.2.1 Initialize Interstitial
//yumiKey YUMI ID , you need to create a YUMI ID on ZPLAY Ads platform. //isStop If you are using ZPLAY Ads, in order to ensure ad performance, please enable ZPLAY Ads rotation and set the field as "NO". public static void initOfficialAdsYuMiInterstitalView(string yumiKey,bool isStop) {}
Sample:
AdsYuMiUnity.initOfficialAdsYuMiInterstitalView("YUMI ID ",false);
4.2.2 Show Interstitial
// Please call to show interstitial after pre-caching AdsYuMiUnity.presentAdsYuMiInterstitalView();
4.2.3 Interstitial Callbacks
-
YuMIInterstitialDidReceiveAdEvent
Interstitial is shown successfully
-
YuMIInterstitialEvent
Interstitial fails to be received
-
YuMIInterstitialDidDismissScreenEvent
Interstitial is closed
-
YuMIInterstitialClickAdEvent
Interstitial is clicked
Access example:
// Request succeeds void YuMIInterstitialDidReceiveAdEvent(){ } // Request fails void YuMIInterstitialEvent(string error){ } //Interstitial is closed void YuMIInterstitialDidDismissScreenEvent(){ } // Interstitial is clicked void YuMIInterstitialClickAdEvent() { }
4.3 Rewarded Video
4.3.1 Initialize Rewarded Video
//yumiKey YUMI ID , you need to create a YUMI ID on ZPLAY Ads platform. public static void initOfficialAdsYuMiVideoView(string yumiKey){}
Sample
AdsYuMiUnity.initOfficialAdsYuMiVideoView("YUMI ID");
4.3.2 Check If There Is An Available Rewarded Video To Be Played
//YES: video available NO: no available video bool isplay = AdsYuMiUnity.isVideoPlayable();
4.3.3 Show Rewarded Video
// please refer Method of isVideoPlayable to judge whether there is video ads to play, if there is, please call the method of displaying video AdsYuMiUnity.playVideo();
4.3.4 Rewarded Video Delegate Callbacks
-
didCompleteVideoEvent
Rewarded video is closed
-
rewardsVideoEvent
User gets rewards
Sample
// Video closed, including completed ones and non-completed ones void didCompleteVideoEvent(){ } // get the video ads rewards void rewardsVideoEvent(){ }
5、Advanced Features
5.1 Test Mode
ZPLAY Ads SDK provides a test mode to test your 3rd-party Integrations.
Use steps:
1、Call the following method to open test page
#import <YuMIDebugCenter/YuMIDebugCenter.h> [[YuMIDebugCenter shareInstance] startDebugging:self];
2、ZPLAY Ads SDK gets configuration and shows third-party platform list
3、Choose a platform
4、Click request to start requesting ads, click show to show ads
5、If Ads showed successfully , the platform is integrated successfully
6、Comment out the test code before app launch
Note: If the adapter is not added to the platform, it will prompt: interstitial of adapter not integrated
5.2 Banner Ads Automatically Adapt To Screen Size
- non auto adsptation
- auto adsptation
When you set banner ad container, you can use isMatchWindowWidth, a parameter of boolean type provided by ZPLAY Ads SDK. This parameter indicates if banner width has populated full screen. When it's true, banner width equals the screen width.