问题
Really basic question here:
I want to build an app that has a bunch of MasterDetail views that can be accessed from a TabView.
I'd like to start with the MasterDetail project template, but if I do that and toss a TabController onto the front of the storyboard, I get a crash.
2012-04-08 12:51:21.205 SMToolkit[22630:fb03] -[UISplitViewController topViewController]: unrecognized selector sent to instance 0x82491c0
2012-04-08 12:51:21.208 SMToolkit[22630:fb03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISplitViewController topViewController]: unrecognized selector sent to instance 0x82491c0'
*** First throw call stack:
(0x16ad022 0x183ecd6 0x16aecbd 0x1613ed0 0x1613cb2 0x2bf9 0x16386 0x17274 0x26183 0x26c38 0x1a634 0x1597ef5 0x1681195 0x15e5ff2 0x15e48da 0x15e3d84 0x15e3c9b 0x16c65 0x18626 0x2a6d 0x29d5)
terminate called throwing an exception(lldb)
All I've done so far is in the storyboard (literally I made a new MasterDetail project, then went into the storyboard and put a tabcontroller in front of it)
回答1:
Simple answer is that the template provided for you in Master Detail includes some code you probably don't want.
In AppDelegate.m look for the following method and simply have it return YES;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
return YES;
}
来源:https://stackoverflow.com/questions/10064563/ios-masterdetail-app-inside-tabcontroller-where-to-start