objective c - Error "Application windows are expected to have a root view controller" (iOS) -


i've created blank iphone app project , show full-screen advertisement during app launch.

i tried install ad following guideline: https://github.com/mopub/mopub-ios-sdk/wiki/interstitial-integration-for-ios

that's i've done finally:

in viewcontroller.h

in viewcontroller.m

actually codes copied previous link.

however, error shows when app runs:

application windows expected have root view controller @ end of application launch

i think error may related loadview method, because if remove loadview method, error disappeared.

in fact, error seems common can searched on internet, don't know how loadview related it, , how can solved in case.

any solutions? lot.

you need this:

add

#import "viewcontroller.h"  

to top of appdelegate.m

and in appdelegate.m, application:didfinishlaunchingwithoptions: method should have code this.

- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions {     // ... other code      // override point customization after application launch.     viewcontroller *viewcontroller = [[viewcontroller alloc] init];      self.window.rootviewcontroller = viewcontroller;     self.window.backgroundcolor = [uicolor whitecolor];     [self.window makekeyandvisible];     return yes; } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -