手动创建窗口,有问题,见代码,求帮助
delegate.h
@interface snAppDelegate : UIResponder <UIApplicationDelegate>
{
    //snViewController *viewControl;
    UIViewController *viewControl;
    UIWindow *window;
}
@property (strong, nonatomic) UIWindow *window;
@end
deletate.m@implementation snAppDelegate
@synthesize window = _windows;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    
    //snViewController *viewControl = [[snViewController alloc] initWithNibName:@"snviewcontroller" bundle:nil];
    snViewController *viewControl = [[snSecondViewController alloc] initWithNibName:@"snSecondViewController" bundle:nil];
    
    self.window.rootViewController = viewControl;
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application{}
- (void)applicationDidEnterBackground:(UIApplication *)application{}
- (void)applicationWillEnterForeground:(UIApplication *)application{}
- (void)applicationDidBecomeActive:(UIApplication *)application{}
- (void)applicationWillTerminate:(UIApplication *)application{}
@end
viewController.h
#import <UIKit/UIKit.h>
@interface snSecondViewController : UIViewController
@end
viewController.m
#import "snSecondViewController.h"
@interface snSecondViewController ()
@end@implementation snSecondViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
    }
    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
}
- (void)viewDidUnload
{
    [super viewDidUnload];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end

解决方案 »

  1.   

    主要是 [self.window makeKeyAndVisible]; 这个地方崩
      

  2.   

    snViewController *viewControl这个地儿你不报错么、不应该是snSecondViewController么
      

  3.   

    真是不好意思 那个地方是写错了 不过改成snSecondViewController还是会崩
      

  4.   

    @synthesize window = _windows;
    为什么右边要写成windows
    不过我跑了一下,没什么问题
      

  5.   

    真是不好意思 那个地方是写错了 不过改成snSecondViewController还是会崩你这个程序我之前试了一下没有问题、你崩了有什么错误提示么
      

  6.   

    没有错误提示 只是每次单步跑到 [self.window makeKeyAndVisible];的时候都会跳到main函数里
      

  7.   

    self.window.backgroundColor = [UIColor whiteColor]; 去了试一下
      

  8.   

    这是log:
    2013-06-07 16:51:56.512 emptySample[21900:c07] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/dongzhongyuan/Library/Application Support/iPhone Simulator/5.1/Applications/2B7C04D7-AAB4-4DEB-AFC2-BE2D293A5F2B/emptySample.app> (loaded)' with name 'snSecondViewController''
    *** First throw call stack:
    (0x14b2022 0xeb2cd6 0x145aa48 0x145a9b9 0x236638 0xdc1fc 0xdc779 0xdc99b 0x3b401 0x3b670 0x3b836 0x4272a 0x2a67 0x13386 0x14274 0x23183 0x23c38 0x17634 0x139cef5 0x1486195 0x13eaff2 0x13e98da 0x13e8d84 0x13e8c9b 0x13c65 0x15626 0x27fd 0x2765 0x1)
    terminate called throwing an exception
    求大神
      

  9.   

    是不是 snSecondViewController拼写错误?