Używam Storyboard, że mam do czynienia z błędem, jak pokazano poniżej, że mój kod został pomyślnie wykonany, ale ich nie ma na stronie lub akcja w symulatorze pokazuje tylko czarny ekran po uruchomieniu obrazu.Programowo wyświetlając widok 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;
}
Błąd
Ten błąd I twarz, gdy nie jestem wybrać punkt wejścia w storybroad jest początkowe Zobacz Controll er.
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
Błąd
Ten błąd I twarz, gdy jestem wybrać punkt wejścia w storybroad jest początkowe 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'
jaki jest twój storyboard skonfigurować? Czy kontroler nawigacyjny jest kontrolerem początkowym? Co to jest kontroler widoku głównego? – rdelmar
Można wykonać pewne sprawdzanie błędów, aby sprawdzić, czy scenorys i widoki są pomyślnie zwracane. Ponadto "(UINavigationController *) self.window.rootViewController" wygląda podejrzanie i powinien zostać przetestowany. – Jenn
Nie rozumiem, jak skonfigurować scenorys i jaki jest kontroler nawigacyjny, początkowy kontroler? proszę powiedz mi, jak mogę znać kontroler widoku root? wyjaśnij to i rozwiąż mój problem. –