Installing the updated iPhone SDK won't let me declare UIToolbarController

Discussion in 'Mac Programming' started by Spike099, Mar 27, 2008.

  1. Spike099 macrumors regular

    Feb 18, 2007
    What was once working code, is now not compiling. In my interface file I have a simple declaration as follows:

    UIToolbarController *toolbarController;
    That come up as an error "syntax error before 'UIToolbarController'"

    When I remove that declaration, the error goes away... However I needed that toolbar. If I declare the tool bar in my loadView method like so

    UIToolbarController *toolbarController = [[UIToolbarController alloc] init];
    The following errors appear.

    'UIToolbarController' undeclared (first use in this function)
    'toolbarController' undeclared (first use in this function)

    Something else that broke. I have a navigation bar with it's style set to UIBarStyleRed. But the following error comes up now.

    error: 'UIBarStyleRed' undeclared

    The other styles work fine. Although I like the black style better now. :)

    Anyone else experiencing issues?
  2. rendezvouscp macrumors 68000

    Aug 20, 2003
    Long Beach, California
    UIToolbarController is now UITabBarController, so you'll need to update your files respectively. I found this out by checking out the Beta 1 to Beta 2 API list of changes that kainjow mentioned. If you have any more issues like this, that's the best place to check first. :)
  3. Spike099 thread starter macrumors regular

    Feb 18, 2007
  4. AlwaysLearning macrumors newbie

    Mar 28, 2008
    This change even breaks one of the XCode startup projects: the Toolbar project just won't compile. It also doesn't seem like it is just changing the names around, UIViewController doesn't offer access to the new TabBarItem the way it did the ToolbarItem.
    Maybe this is all designed to make it play nice with the InterfaceBuilder style of doing things, but so far I haven't figured out how to make it do the things I had working before in code, like attaching NavViewControllers to a TabBarController. This whole update feels pretty rushed out given the way that it breaks stuff and doesn't seem to try very hard to explain either the changes or how to use the new tools. When is the documentation going to get an update to match?
  5. Sbrocket macrumors 65816


    Jun 3, 2007
    Beta SDKs do that to you, AlwaysLearning. Expect things to not work when you updated to the latest beta - its the rule, not the exception.
  6. Sayer macrumors 6502a


    Jan 4, 2002
    Austin, TX
    There is a ton of documentation and resources available right from Apple and listed in the new Xcode "Welcome" window.

    A lot of this stuff is covered in the docs or the headers/frameworks in the SDK itself.
  7. NetMage macrumors member

    Oct 21, 2007
    Just replace toolbarItem with tabBarItem in UIViewController and it works.

Share This Page