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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Integrating Unity into native iOS applications

Discussion in 'iOS and tvOS' started by MuuM, May 12, 2020.

  1. MuuM

    MuuM

    Joined:
    Aug 4, 2017
    Posts:
    4
    Use the UniWebView plugin In Unity,When Integrating it into native iOS applications an error occurred:
    <UniWebView-iOS> Unable to find rootViewController in Unity App Controller. Using window's root view controller instead: <LCBaseTabBarController: 0x10ca58a00>
    superclass: UITabBarController
    title: (null)
    view: <UILayoutContainerView: 0x113f21da0; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x282ef2d00>>
    viewControllers(3): (
    [0]<LCCNavigationController: 0x10d365600>,
    [1]<LCCNavigationController: 0x10d37a400>,
    [2]<LCCNavigationController: 0x10ca8c200>
    )
    selectedViewController(2): <LCCNavigationController: 0x10ca8c200>

    How can I solve this problem?
     
    josefgrunig likes this.
  2. josefgrunig

    josefgrunig

    Joined:
    Jan 23, 2017
    Posts:
    56
    Same issue here? Did you find a solution?
     
  3. josefgrunig

    josefgrunig

    Joined:
    Jan 23, 2017
    Posts:
    56
    Thanks to UniWebView support I understood I had to return rootViewController from the AppDelegate.

    When integrating Unity in a native app we do not use Unity’s AppDelegate (named UnityAppController), but the native one (named AppDelegate) and proxy event toward Unity.
    The fix is easy: add a method that returns Unity’s rootViewController from AppDelegate

    - (UIViewController *) rootViewController {
    return self.unityAppController.rootViewController;
    }
     
    ctsalidis likes this.
  4. ctsalidis

    ctsalidis

    Joined:
    Jun 22, 2015
    Posts:
    3

    Where did you call this method?
     
    Last edited: Jul 22, 2020
  5. josefgrunig

    josefgrunig

    Joined:
    Jan 23, 2017
    Posts:
    56
    You simply need to add it to your AppDelegate class