I’m trying to implement Unity Ads for iOS. When I click to show ad I get this error in the console:
Warning: Attempt to present <UnityAdsMainViewController: 0x1a728000> on <UnityLandscapeRightOnlyViewController: 0x1a4c72c0> whose view is not in the window hierarchy!
Anyone has come across this error before and knows how to deal with it?
Interesting, ran into same issue. I was trying to limit auto rotation to LandscapeLeft and LandscapeRight only. Works perfectly fine on Android… iOS pukes.
Hi,
I tried changing the rotation settings on my game (is in portrait mode), the error stays and Unity ads aren’t shown:
Warning: Attempt to present <UnityAdsMainViewController: 0x2188d8a0> on <UnityDefaultViewController: 0x1ed25050> whose view is not in the window hierarchy!
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 the asset store update seems to be taking longer than what I expected. Here is the same fix that you can put in your project manually. The relevant file is Assets/Plugins/iOS/UnityAdsUnityWrapper.mm.
Find the show method and add the following line on top of the line with return statement:
Sometimes you can get non-ASCII characters when copy&pasting from browser to some text editor. It appears that Xcode complains about non-ASCII character at the end of line. It’s obviously difficult to say what kind of whitespace character there is but I would try to delete that somehow. If that doesn’t work with your usual text editor, maybe you can try a different text editor that would work better with whitespace characters.