標籤:class blog code http com strong
轉載地址:http://blog.sina.com.cn/s/blog_6784e6ea01017jfy.html
最新更正:這個提示幾乎不影響編譯和運行,可以不用設定。
產生這個提示的操作:在xcode4.6中建立一個名字為appTest空工程,create一個ios-application-empty application,直接編譯運行
錯誤提示:雖然編譯通過,也能運行,但是底下有錯誤提示“application windows are expected to have a root view controller” 原因:在較新的xcod上都會出現這種錯誤。在iOS5之前的版本,應用載入時,需要一個root view controller,在iOS5以下的版本會有MainWindow作為開機檔案,iOS5以後的版本沒有了。需要手動建立一個root view controller 解決:①建立一個類file - new file - object-c class,名字myViewController,繼承於UIViewController②在testAppDelegate.h中添加屬性viewController,代碼如下:@property (strong, nonatomic) myViewController* viewController ③在testAppDelegate.m中初始化viewController並賦值給rootViewControllerself.viewController = [[ViewController alloc] initWithNibName:@"myViewController" bundle:nil];self.window.rootViewController = self.viewController; 再次編譯運行已經沒有錯誤了。