Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
309 views
in Technique[技术] by (71.8m points)

iphone - Blank black screen when running my iPad App

I've run into a sort of roadblock with my iPad app. I apparently made some unrecoverable change to my code recently and now it will only launch with a black screen. It displays the LoadingImage for a split second and goes right to black.

In an effort to streamline what sort of problem I'm looking for, I'd like some advice on where should I start looking? I've done my best so far to check and recheck everything I can think of already, so I'm ready to start the search over with some guidance. More specifically, what are some of the most common reasons that your code will just result in a black screen, without running any code at all. Would it be an InterfaceBuilder issue, an Xcode .h issue, a .m issue with my methods or what? I've sort of accidentally solved the issue a few times in the past, but am struggling to find the source this time. I've added NSLog calls throughout my code to help narrow down the problem (in every .m file actually) and none of them print to the log at all.

Facts:

  • I'm using the latest Xcode and iOS SDK (for iPad, 3.2).
  • It does it in both the simulator and my actual iPad.
  • My iPad is not, and hasn't ever been Jailbroken.
  • My app is actually really simple, it's just a single split-view with a detail view and a custom root view which has a resized table in it.

Any help anyone can provide would really save me a lot of whining, mopeyness and crying. heh

Thanks.

Additional Requested Code:
viewDidLoad from MasterView.m

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"Master: This self: %@", self);

    self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0);
    self.arrMenuOptions = [[NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"MainMenuOptions" ofType:@"plist"]] retain];
}

viewDidLoad from DetailView.m

- (void)viewDidLoad {
    /// Initialize the preset things.
    NSLog(@"Detail: This self: %@", self);
    eleDetailToolbar.barStyle = UIBarStyleBlack;

    eleWebView.opaque = NO;
    eleWebView.backgroundColor = [UIColor clearColor];
    eleWebView.delegate = self;
    [super viewDidLoad];
}

AppDelegate excerpt

@implementation AssistantAppDelegate

@synthesize window, splitViewController;//, detailViewController, masterViewController;
//rootViewController, eleMasterNavigationItem

#pragma mark -
#pragma mark Application lifecycle

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    NSLog(@"AppDelegate: This self: %@", self);

    // Override point for customization after app launch    

    // Add the split view controller's view to the window and display.
    [window addSubview:splitViewController.view];
    [window makeKeyAndVisible];

    return YES;
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. Are you getting any error messages on the Run console?
  2. Do you have a view hooked up in interface builder? Or trying to load a non-existent XIB file?
  3. Do you have the main nib file base name key populated in the info.plist file?
  4. What is in your applicationDidFinishLaunching and viewDidLoad methods?
  5. Have you deleted any references to something in Interface Builder?
  6. Have you added any new resources recently that could be corrupted?

Please update your question if possible with code

Update based on comments: How are you adding a window if you don't have an applicationDidFinishLaunching method?

You should have something like this in the App Delegate .m file:

@synthesize window;
@synthesize viewController;

- (void)applicationDidFinishLaunching:(UIApplication *)application {    

    // Override point for customization after app launch    
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];

}

If this isn't here, no window gets added, and you get a black screen.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...