Tuesday, 22 March 2011

Subclassed UIViewController returns: 'applications are expected...'


it's been while since i've used uikit extent (been enjoying cocos2d game stuff). seemed flow easy though when went back, right until moment decided make app not set xib-containing template.

upon running in simulator received following message: "applications expected have root view controller @ end of application launch."

sounds sensible. can't break head around why subclassed uiviewcontroller won't accepted view controller..

have subclassed uiviewcontroller class called mastercontroller. has following init method:

code:
-(id) init  {  	self	=	[super init];  	if (self) {  		nslog(@"%@ mastercontroller init", self);  		[self loadview];  		return self;  	}  	else{  		return nil;  	}  }
i've added following property appdelegate:
code:
@property (nonatomic, retain) mastercontroller *mastercontroller;
it should come in application: didfinishlaunchingwithoptions: method
code:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions  {  	nslog(@"%@ appdelegate application", self);  	      self.window = [[[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]] autorelease];      self.window.backgroundcolor = [uicolor blackcolor];	    	self.mastercontroller		= [[[mastercontroller alloc] init]autorelease];  	self.window.rootviewcontroller	= self.mastercontroller;  			  	[[self window] makekeyandvisible];  	return yes;  }
the above mentioned message returned though.
if replace own class standard uiviewcontroller message not returned seems obvious subclass not accepted reason...
 

must in code / settings we're not seeing because tried same thing above in test project , worked fine: no "applications expected..." message.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment