[Turn]application windows is expected to a root view controller error

Source: Internet
Author: User

Reprint Address: http://blog.sina.com.cn/s/blog_6784e6ea01017jfy.html

Latest corrections: This hint has little effect on compiling and running, and can not be set.

Action to generate this hint: Create a ios-application-empty application in xcode4.6 with a name of apptest empty project, and run the direct compilation

Error message: Although compiled through, can also run, but there is an error under the "Application windows is expected to a root view Controller" Cause: This error occurs on newer xcod.in the previous version of IOS5, when the application was loaded, a root view controller was required, and the version below IOS5 would have MainWindow as the boot file, iOS5 later versions did not. Need to manually create a root view controller Solution:① Create a class File-new File-object-c class, name Myviewcontroller, inherit from Uiviewcontroller② Add the attribute Viewcontroller in the TestAppDelegate.h code as follows:@property (Strong, nonatomic) myviewcontroller* Viewcontroller ③ initializes viewcontroller in TESTAPPDELEGATE.M and assigns values to RootviewcontrollerSelf.viewcontroller = [[Viewcontroller alloc] initwithnibname:@ "Myviewcontroller" bundle:nil];Self.window.rootViewController = Self.viewcontroller; It is no longer an error to compile and run again.  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.