Xcode 4.3, XIB files and deployment target iOS 3.1

  • Hello, all ...

    I'm working on an app that has to work on first-gen iPod touch devices. I set the deployment target to 3.1 and made sure armv6 was specified such that my app now at least launches on said firstgen iPod touch. However, it hangs before showing the tab bar or first view controller:

            viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController_iPhone" bundle:nil] autorelease];
            viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController_iPhone" bundle:nil] autorelease];

        self.tabBarController = [[[UITabBarController alloc] init] autorelease];
        self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, nil];  // HANGS HERE
        self.window.rootViewController = self.tabBarController;
        [self.window makeKeyAndVisible];

    The view controllers are the Xcode-generated versions -- i've not added any UI elements yet. Though initWithNibName:bundle: is called on each VC, their viewDidLoad methods are _not_ called. Is there something special I need to do with the Xcode-generated XIB files in order to support iOS 3.1?

    Regards,

    John
  • Presuming that the firstgen iPod touch has iOS 3.x on it, it is probably
    crashing here:

    > self.window.rootViewController = self.tabBarController;

    Since rootViewController was introduced to UIWindow in iOS 4.0. Pre-iOS 4.0
    you need to use (from what I recall):

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

    Which will cause newer versions of iOS to complain. Though there may be
    other issues related to Xcode 4.3 supporting ancient versions of iOS (check
    the developer forums) and pay attention to Xcode build warnings.
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today