Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6599689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:31:25+00:00 2026-05-25T18:31:25+00:00

i’m working with Xcode 4 and my software work well on iPhone 4 and

  • 0

i’m working with Xcode 4 and my software work well on iPhone 4 and simulator but when i test it on devices like iPhone 2G or 3Gs i have this error immediately when i run the code :

Terminating app due to uncaught exception ‘NSUnknownKeyException’, reason: ‘[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key rootViewController.’

searching the way to solve the problem i build a hello world program and do not work on iPhone 3gs … searching the solutions i found this :

// self.window.rootViewController = self.viewController;
[self.window addSubview: [self.viewController view]];

use addsubview like this and the program should run fine …

Ok the hello world run well but my program does not work at all …

maybe this is the code i should change … (but i don’t now really ..)

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
// Override point for customization after application launch.

//this and application should run on 3.1.3
if ([self.window respondsToSelector:@selector(setRootViewController:)])
    self.window.rootViewController = self.viewController;
else
    [self.window addSubview:self.viewController.view];

// Add registration for remote notifications
[[UIApplication sharedApplication] 
 registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

// Clear application badge when app launches
//application.applicationIconBadgeNumber = 0;

[self.window makeKeyAndVisible];

return YES;

}

i search some info about this problem but every time i search i found only to change the line
self.window.rootViewController = self.viewController;

but unfortunately don’t help much.

thanks guys for you’re patience 🙂

EDIT :

i change the code

if ([self.window respondsToSelector:@selector(setRootViewController:)])
    self.window.rootViewController = self.viewController;
else
    [self.window addSubview:self.viewController.view];

to

[self.window addSubview:self.viewController.view];

but the error is still the same …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:31:26+00:00Added an answer on May 25, 2026 at 6:31 pm

    UIWindow does not have a rootViewController property in iOS versions less than 4.0. Hence if you want to support these versions, you can’t use self.window.rootViewController = myViewController;, you generally have to add the controller’s view to the window, i.e.: [self.window addSubview:myViewController.view];

    Edit: the problem is how you are checking for what version it is, since 3.1.3 could have still responded to setRootViewController (built in but not public variable).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.