question

Blundig avatar image
Blundig asked

Unity iOS doesn't display interstitial ad

Hi, I'm using the latest Unity Mobile Ads plugin to display interstitial ads. I can get the ad preloaded (in testing mode), but when I call ShowInterstitialAd() nothing appears. The AdShown result from that method has a value of true, so the SDK thinks it is showing the ad, but it isn't there. From the log, it looks like the SDK is trying to present the ad view controller onto an incorrect screen controller? 2015-07-20 18:46:39.825 fillthevoid[316:60b] Interstitial will be presented. 2015-07-20 18:46:39.828 fillthevoid[316:60b] Warning: Attempt to present on whose view is not in the window hierarchy! 2015-07-20 18:46:39.830 fillthevoid[316:60b] Interstitial has been presented. This effectively hangs the game, since there is nothing to dismiss. Did I configure something wrong, or is this a bug? Thanks
mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered
Hi Blundig, I wasn't able to reproduce this issue in my tests -- are you using the latest version of Amazon Mobile Ads? https://developer.amazon.com/public/apis/earn/mobile-ads/plugins Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Blundig avatar image
Blundig answered
Yes, I am using the current version of the SDK from the link you provided, with Unity 5.1.2p1. FYI - The same code works fine if I do an Android build.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

justin avatar image
justin answered
Hi Blundig, Are you receiving any error messages in your Xcode console while running this? If you could, please ensure the following steps are completed: [pre] In XCode: Open your app in XCode Click on your project file and Go to "Build Phases" -> "Link Binary With Libraries". Add the AmazonAd framework located at [AMAZON AD SDK FOLDER]/AmazonAd.framework Add the following frameworks if they are not already linked Add the AdSupport.framework Add the CoreLocation.framework Add the SystemConfiguration.framework Add the CoreTelephony.framework Add the MediaPlayer.framework Add the EventKit.framework Add the EventKitUI.framework Add the StoreKit.framework [/pre] You could also create a new script and test the following sample directly: [code]using System.Collections; using com.amazon.mas.cpt.ads; public class MobileAdsTest : MonoBehaviour { IAmazonMobileAds mobileAds = AmazonMobileAdsImpl.Instance; ApplicationKey key = new ApplicationKey(); ShouldEnable shouldEnable = new ShouldEnable(); void Start () { key.StringValue = "sample-app-v1_pub-2"; shouldEnable.BooleanValue = true; mobileAds.SetApplicationKey (key); mobileAds.EnableLogging (shouldEnable); mobileAds.EnableTesting (shouldEnable); //Optional mobileAds.EnableGeoLocation(shouldEnable); } void OnGUI () { //Create a new slot for interstitial if(GUI.Button(new Rect(20,40,80,20), "Create Ads")) { Ad interstialAd = mobileAds.CreateInterstitialAd(); string adType = interstialAd.AdType.ToString(); long identifier = interstialAd.Identifier; Debug.Log (identifier + " " + adType); } // Load interstitial if(GUI.Button(new Rect(20,80,80,20), "Load Ads")) { LoadingStarted response = mobileAds.LoadInterstitialAd(); bool loadingStarted = response.BooleanValue; Debug.Log (loadingStarted); } // Display interstitial if(GUI.Button(new Rect(20,120,80,20), "Show Ads")) { AdShown shownInterstitialAd = mobileAds.ShowInterstitialAd(); bool adShown = shownInterstitialAd.BooleanValue; Debug.Log("adShown: " + adShown); } } }[/code] Thanks!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.