I am in the process of adding UnityAds to our game but as the subject suggests am having problems viewing the ads on device. I get this warning in XCode when I try to play the video:
Warning: Attempt to present <UnityAdsMainViewController: 0x1a350880> on <UnityDefaultViewController: 0x17ee2d30> whose view is not in the window hierarchy!
This happens after I have checked that a video is available (which it is) and then attempted to play it. My code looks like this:
// At startup
Advertisement.Initialize(unityAdsID);
// Later when someone clicks the watch video button
Hi, I am having exactly the same warning & setup as you on iOS. For Android and in the Editor everything is working fine.
Really hope someone can help…
We have uploaded a new version 1.1.1 to Asset Store that fixes this issue. It will be available once asset store team processes the submission queue.
Unfortunately we have also discovered another iOS issue with Unity 5. If you are using Unity 5 and iOS, AdSupport.framework doesn’t get automatically linked into the project. To fix this manually, go to Unity-iPhone targets Build Phases tab and add AdSupport.framework to the Link Binary With Libraries section. We are working to automate this.
Unfortunately asset store update appears to take a bit longer than what I expected. You can do the same fix manually by updating Assets/Plugins/iOS/UnityAdsUnityWrapper.mm.
Find the show method and add the following line on top of the line with return statement: