用mainstroyboard代替xib文件

目前工程在app delegate中使用MainWindow.xib当作主要的nib文件,在main.m文件中的代码:

int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}

享用Mainstoryboard代替,在info.plist文件中修改时报错:

there is no app delegate set. An app delegate class must be specified to use a main storyboard file

请高手解惑。

在xcode中,点击左侧的project,找到Summary 页签项,在iphone/ipod deployment info 栏下找到Main Storyboard :在右边下拉中选择你的Storyboard文件。同时把Main Interface 右侧下拉列表中的内容清空。

导致你上述问题的根本原因是,你的main函数中未指明应用的AppDelegate.一般的main函数为系统生成,不需要修改。默认应该如下。

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}

在上述代码中指明了AppDelegate类为应用程序的代理类。而在你的上述代码中并没有指明是哪个.