Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Warning: Attempt to present <UnityAdsMainViewController: 0x1a728000>

Discussion in 'Unity Ads & User Acquisition' started by Bedbug, Jan 14, 2015.

  1. Bedbug

    Bedbug

    Joined:
    Feb 5, 2011
    Posts:
    26
    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?

    Thanks in advance.
     
  2. Bedbug

    Bedbug

    Joined:
    Feb 5, 2011
    Posts:
    26
    In case someone comes across the same issue, it was caused by our code messing with the allowed orientations.

    e.x.
    Screen.orientation = ScreenOrientation.LandscapeRight;

    We removed this restriction and the error went away.
     
    Salazar likes this.
  3. tstpierre_nss

    tstpierre_nss

    Joined:
    Jul 3, 2012
    Posts:
    118
    Interesting, ran into same issue. I was trying to limit auto rotation to LandscapeLeft and LandscapeRight only. Works perfectly fine on Android... iOS pukes.
     
  4. MauiMauo

    MauiMauo

    Joined:
    Mar 8, 2013
    Posts:
    21
    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!


    Would be great if someone can help!
     
  5. jannen

    jannen

    Unity Technologies

    Joined:
    Aug 21, 2014
    Posts:
    28
    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.
     
    georgepiva likes this.
  6. georgepiva

    georgepiva

    Joined:
    Dec 16, 2013
    Posts:
    14
    @jannen Does Asset Store Team process the submission queue during the weekends?
     
    Last edited: Mar 7, 2015
  7. Tod8Cruz

    Tod8Cruz

    Joined:
    Jul 17, 2014
    Posts:
    2
    @jannen
    I also want to know when I can get 1.1.1 package. How long does it take usually?
     
  8. qwiboo

    qwiboo

    Joined:
    Nov 20, 2013
    Posts:
    10
    Same here! Wish I knew that the package was broken before updating.
     
  9. jannen

    jannen

    Unity Technologies

    Joined:
    Aug 21, 2014
    Posts:
    28
    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:

    [[UnityAds sharedInstance] setViewController:UnityGetGLViewController()];​

    This will be line 140 and the return statement of show method will be on line 141.
     
  10. georgepiva

    georgepiva

    Joined:
    Dec 16, 2013
    Posts:
    14
    @jannen Thank you for sharing the fix.
     
  11. Deleted User

    Deleted User

    Guest

    @jannen Thanks for providing the fix. I followed the instructions but its throwing an error:

    .../UnityAdsUnityWrapper.mm:139:80: Non-ASCII characters are not allowed outside of literals and identifiers

    Screen Shot 2015-03-10 at 5.45.26 pm.png
     
  12. jannen

    jannen

    Unity Technologies

    Joined:
    Aug 21, 2014
    Posts:
    28
    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.
     
  13. Deleted User

    Deleted User

    Guest

    no probs, thanks for the reply :) Just saw v1.1.2 is up on the asset store now and that's probably got all this fixed up!
     
  14. jannen

    jannen

    Unity Technologies

    Joined:
    Aug 21, 2014
    Posts:
    28
    Yes, the new release is now available and it fixes this issue.
     
  15. stefanob

    stefanob

    Joined:
    Nov 26, 2012
    Posts:
    66
    I got the same problem now with Unity 5.2.1f1 Personal Edition.
    I set the following:

    Screen.orientation=ScreenOrientation.AutoRotation;
    Screen.autorotateToPortrait=false;
    Screen.autorotateToPortraitUpsideDown=false;
    Screen.autorotateToLandscapeLeft=true;
    Screen.autorotateToLandscapeRight=true;

    Any ideas?

    [EDIT]
    Okay found it. I do the settings in the Player Settings and:

    1. Log into the Unity Ads Admin
    2. Select your game profile
    3. Select the Monetization Settings tab
    4. Select the Show Advanced Settings button
    5. Select the Settings button for the zone you are using
    6. Check the box under the Options section to enable
     
    Last edited: Dec 8, 2015