Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 2, 2012, 11:02 PM   #1
NickFalk
macrumors 6502
 
Join Date: Jun 2004
Subclassed UIViewController returns: 'applications are expected...'

It's been a while since I've used UIKit to any extent (been enjoying cocos2d for my game stuff). It seemed to flow really easy though when I went back, right up until the moment I decided to make an app that was not set up with a xib-containing template.

Upon running it in the simulator I received the following message: "applications are expected to have a root view controller at the end of application launch."

Which sounds sensible. However what I can't break my head around is why it my subclassed UIViewController won't be accepted as a view controller..

I have a subclassed UIViewController class called MasterController. It has the 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 the following property to my AppDelegate:
Code:
@property (nonatomic, retain) MasterController *masterController;
It should all come together in the 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 is returned though.
If I replace my own class with a standard UIViewController the message is not returned so it seems obvious that my subclass is not accepted for some reason...
NickFalk is offline   0 Reply With Quote
Old Feb 3, 2012, 09:26 AM   #2
dejo
Demi-God (Moderator)
 
dejo's Avatar
 
Join Date: Sep 2004
Location: Colorado
Must be something in the code / settings we're not seeing because I tried the same thing as above in a test project and it worked fine: no "applications are expected..." message.
__________________
My iOS Apps: a.k.a., DreamStream
I support the MacRumors Blood Drive!
dejo is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Tags
subclassed, uiviewcontroller

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Subclasses and Protected Methods darkandlong iPhone/iPad Programming 8 Sep 22, 2011 05:34 AM
call method from subclass of uiimageview sregorcinimod iPhone/iPad Programming 3 Apr 22, 2011 11:54 PM
expected '=', ',', ';', 'asm' or '__attribute__' before '*' token wanting2learn iPhone/iPad Programming 4 Oct 23, 2010 10:35 AM
subclass UIViewController and basic template arnieterm iPhone/iPad Programming 0 Aug 28, 2008 07:30 AM
What are these '\n' and '\t' larswik Mac Programming 5 Oct 7, 2006 10:56 AM


All times are GMT -5. The time now is 07:36 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Privacy / DMCA contact / Affiliate and FTC Disclosure
Copyright 2002-2013, MacRumors.com, LLC