Ich benutze Storyboard, dass ich Fehler wie unten gezeigt bin, wird mein Code erfolgreich ausgeführt, aber es ist keine Seite zeigen oder Aktion im Simulator zeigen nur schwarzen Bildschirm nach dem Start des Bildes.Programmatisch Storyboard-Ansicht anzeigen
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;
}
Fehler
Dieser Fehler i Gesicht, wenn ich bin nicht Einstiegspunkt wählen in storybroad Initial ist Kontrollansicht anzeigen 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
Fehler
Dieser Fehler i Gesicht, als ich Einstiegspunkt in storybroad ist 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'
Wie ist Ihr Storyboard einrichten? Ist ein Navigationscontroller der anfängliche Controller? Was ist der Root View Controller? – rdelmar
Sie könnten eine Fehlerüberprüfung durchführen, um zu sehen, ob Storyboard und Views erfolgreich zurückgegeben werden. Außerdem sieht '(UINavigationController *) self.window.rootViewController' verdächtig aus und sollte getestet werden. – Jenn
Ich verstehe nicht, wie ich Storyboard einrichten und was Navigationscontroller der anfängliche Controller ist? Bitte sagen Sie mir, wie kann ich Root View Controller kennen? erkläre es und bitte slove mein Problem. –