PJR
PJR

Reputation: 13180

TabbarController crashes in 3.0

i am using TabBarController , it is working fine in my ipod.

but my application is crashing it 3.0 . any help please?

self.window.rootViewController = self.tabBarController; //crashing here

and log shows

-[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x127c80
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -    
[UIWindow setRootViewController:]: unrecognized selector sent to instance 0x127c80'

Upvotes: 0

Views: 164

Answers (2)

Seamus Campbell
Seamus Campbell

Reputation: 17916

The crash is because you're calling a method that doesn't exist, not because your variables are not initialized.

-setRootViewController doesn't exist prior to iOS 4.0. Use

[self.window addSubview:self.tabBarController.view];

instead.

Or, update your target platfor to 4.0.2 or later. It's probably less than 5% of users that aren't using iOS 4 at this point.

Upvotes: 2

alloc_iNit
alloc_iNit

Reputation: 5183

This may show you the right direction. Let me know if the problem still continues.

Due to executing on different versions of iOS, that method may have deprecated.

Upvotes: 2

Related Questions