Application windows are expected to have a root view controller at the end of application launch - Fehlermeldung wegbekommen

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Application windows are expected to have a root view controller at the end of application launch - Fehlermeldung wegbekommen

    Ich habe da viele Tutorials aus einem Buch "Spiele entwickeln, für Ipad ... etc von Hanser" aber allen Beispielen und jetzt auch bei allem was ich mir daraus im Verlauf gebastelt habe kommt die Fehlermeldung:
    "Application windows are expected to have a root view controller at the end of application launch" im Program Output. :cursing:

    Ich habe keinen Schimmer was ich falsch gemacht habe, ist bei mir eine Xcode Einstellung falsch? Oder hat jeder die Fehlermeldung?
    Und kann ich sie ignorieren? Auf iPad und iPhone läuft nämlich alles ohne Probleme, es ist nur eine Warnmeldung so wie es aussieht.

    Das hier ist der relevante Code:
    ( eigentlich original aus dem Buchbeispiel, habe da nichts rumgepfuscht bis auf die mainView.backgroundColor :rolleyes:

    Quellcode

    1. #import "MyGameAppDelegate.h"
    2. @implementation MyGameAppDelegate
    3. @synthesize window = _window;
    4. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    5. self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    6. mainView = [[MainView alloc] initWithFrame: [UIScreen mainScreen].applicationFrame];
    7. mainView.backgroundColor = [UIColor blackColor];
    8. [mainView setupOGL];
    9. [self.window addSubview: mainView];
    10. [self.window makeKeyAndVisible];
    11. return YES;
    12. }
    13. - (void) startGameLoop {
    14. NSString *deviceOS = [[UIDevice currentDevice] systemVersion];
    15. bool forceTimerVariant = TRUE;
    16. if (forceTimerVariant || [deviceOS compare: @"3.1" options: NSNumericSearch] == NSOrderedAscending) {
    17. //33 frames per second -> timestep between the frames = 1/33
    18. NSTimeInterval fpsDelta = 0.0303;
    19. timer = [NSTimer scheduledTimerWithTimeInterval: fpsDelta
    20. target: self
    21. selector: @selector( loop )
    22. userInfo: nil
    23. repeats: YES];
    24. } else {
    25. int frameLink = 2;
    26. timer = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget: self selector: @selector( loop )];
    27. [timer setFrameInterval: frameLink];
    28. [timer addToRunLoop: [NSRunLoop currentRunLoop] forMode: NSDefaultRunLoopMode];
    29. }
    30. NSLog(@"Game Loop timer instance: %@", timer);
    31. }
    32. - (void) stopGameLoop {
    33. [timer invalidate];
    34. timer = nil;
    35. }
    36. - (void) loop {
    37. [mainView drawRect:[UIScreen mainScreen].applicationFrame];
    38. }
    39. - (void) applicationDidBecomeActive: (UIApplication *) application {
    40. [self startGameLoop];
    41. }
    42. - (void) applicationWillResignActive: (UIApplication *) application {
    43. [self stopGameLoop];
    44. }
    45. - (void)applicationDidEnterBackground:(UIApplication *)application {}
    46. - (void)applicationWillEnterForeground:(UIApplication *)application {}
    47. - (void)applicationWillTerminate:(UIApplication *)application {}
    48. - (void) dealloc {
    49. [self stopGameLoop];
    50. [timer release];
    51. [_window release];
    52. [mainView release];
    53. [super dealloc];
    54. }
    55. @end
    Alles anzeigen
  • Du solltest Deinen MainView über eine Unterklasse von UIViewController verwalten und die Zeile

    Quellcode

    1. [self.window addSubview: mainView];
    durch

    Quellcode

    1. MainViewController *theMainViewController = [[MainViewController alloc] init]; // MainViewController verwaltet MainView
    2. self.window.rootViewController = theMainViewController;
    „Meine Komplikation hatte eine Komplikation.“
  • Danke!
    habe ich gerade gemacht, ich musste noch in "UIViewController" umbenennen. Jetzt ist die Fehlermeldung mit, aber die Komplikation brachte eine Komplikation.
    Das Display bleibt schwarz und es tut sich gar nichts mehr wenn ich das Programm starte ^^ *lol*

    Quellcode

    1. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    2. self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    3. mainView = [[MainView alloc] initWithFrame: [UIScreen mainScreen].applicationFrame];
    4. mainView.backgroundColor = [UIColor blackColor];
    5. [mainView setupOGL];
    6. //[self.window addSubview: mainView];
    7. UIViewController *theMainViewController = [[UIViewController alloc] init]; // MainViewController verwaltet MainView
    8. self.window.rootViewController = theMainViewController;
    9. [self.window makeKeyAndVisible];
    10. return YES;
    11. }
    Alles anzeigen