我正在使用 Storyboard,我遇到了如下所示的错误,我的代码已成功执行,但它们没有页面显示或模拟器中的操作仅在启动图像后显示黑屏。
ClsMainPageAppDelegate.h
#import <UIKit/UIKit.h>
@interface ClsMainPageAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
ClsMainPageAppDelegate.m
#import "ClsMainPageAppDelegate.h"
#import "ClsMainPageViewController.h"
#import "ClsTermsandConditionViewController.h"
@implementation ClsMainPageAppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
NSUserDefaults *fetchDefaults = [NSUserDefaults standardUserDefaults];
int message = [fetchDefaults integerForKey:@"checkvalue"];
NSLog(@"Message Hello : %i",message);
if(message == 1)
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ClsMainPageViewController *mvc = [storyboard instantiateViewControllerWithIdentifier:@"BeIinformedPage"];
[(UINavigationController*)self.window.rootViewController pushViewController:mvc animated:NO];
NSLog(@"Launched Home Page");
}
else
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
ClsTermsandConditionViewController *mvc = [storyboard instantiateViewControllerWithIdentifier:@"termsandConditionControl"];
[(UINavigationController*)self.window.rootViewController pushViewController:mvc animated:NO];
NSLog(@"Launched Terms and Conditions Page");
}
return YES;
}
错误
当我没有在 storybroad 中选择入口点时,我面临的这个错误是 Initial View Controller。
2013-07-17 19:38:12.749 BeInformed[1011:c07] Failed to instantiate the default view
controller for UIMainStoryboardFile 'MainStoryboard' - perhaps the designated entry
point is not set?
2013-07-17 19:38:16.127 BeInformed[1011:c07] Message Hello : 0
2013-07-17 19:38:18.333 BeInformed[1011:c07] Launched Terms and Conditions Page
错误
当我在 storybroad 中选择入口点时遇到的这个错误是 Initial View Controller (termsandConditionControl)
2013-07-17 19:53:19.839 BeInformed[1057:c07] Message Hello : 0
2013-07-17 19:53:26.175 BeInformed[1057:c07] - [ClsTermsandConditionViewController
pushViewController:animated:]: unrecognized selector sent to instance 0x71b2f50
2013-07-17 19:53:26.176 BeInformed[1057:c07] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason: '-[ClsTermsandConditionViewController
pushViewController:animated:]: unrecognized selector sent to instance 0x71b2f50'