iPad simulator 5.1 doesn't work with the latest Homepwner


#1

After I’d build and run the Homwpwner from Chapter 12, the iPad Simulator 5.1 showed the screen as shown.
But it works well on my real iPad 2. Any reason for that??


#2

Try restarting your machine, perhaps?


#3

I’ve closed all Xcode, simulator and restarted the machine, as well as deleted the app in the simulator. It was the same result :frowning:


#4

Hm. It looks like there isn’t even an app running in that simulator window. What does the code in your AppDelegate.m file look like? is the window being placed on the screen, and is a view controller being set as the root view controller?


#5

Here is the HomepwnerAppDelegate.m

[code]#import “HomwpwnerAppDelegate.h”
#import “ItemsViewController.h”

@implementation HomwpwnerAppDelegate

@synthesize window = _window;

  • (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.

    // Create an ItemsViewController
    ItemsViewController *itemsViewController = [[ItemsViewController alloc] init];

    // Create an instance of UINavigationController
    // its stack contains only itemsViewController
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:itemsViewController];

    // Place navigation controller’s view in the window hierarchy
    [[self window] setRootViewController:navController];

    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
    }

  • (void)applicationWillResignActive:(UIApplication *)application
    {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

  • (void)applicationDidEnterBackground:(UIApplication *)application
    {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

  • (void)applicationWillEnterForeground:(UIApplication *)application
    {
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }

  • (void)applicationDidBecomeActive:(UIApplication *)application
    {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

  • (void)applicationWillTerminate:(UIApplication *)application
    {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }

@end
[/code]

It’s strange that it works well on my tangible iPad 2 but it shows the above gray screen on simulator. Have you encountered such incident? Any possibilities? :question: :question:


#6

I haven’t seen that before. Do other apps work on the simulator - that is, can you create a quick app and change the window color to something distinct (like red)?


#7

I found the reason for that at last. Sorry about that having my stupid question positing here and my carelessness.

The gray screen is actually the lower half of the iPad simulator screen. I don’t know why but it initialized to the lower half showing the background gray color only, which was normal. :astonished:
When I scrolled up the screen, the navigation bar showed up. :smiley:

Thank you Joe for this patient help, that it turns out my carelessness. :frowning:


#8

Ah, the perils of a 13"/15" monitor.


#9

That is true. I’m using MBA 13".


#10

Ha ha - Don’t feel too bad - the screen size thing threw me too - i’m on a 15 inch 2008 macbook pro - not a good screen size for iPad developing


#11

The same thing happened to me. This forum helps!