views:

668

answers:

2

Hello,

I'm using a TTLauncherView and for that I declare a view controller as TTViewController, as is in TTCatalog tutorial app. Declare a TTLauncherView var inside that view, add items, and so on.

In my app's main view is a button calling the previous view with the following code:

-(void) switchToButtonOrderingView
{
    ButtonOrderingViewController *ButtonOrderingView=
    [[ButtonOrderingViewController alloc] initWithNibName:@"ButtonOrderingViewController" bundle:nil]; 
    self.ButtonOrderingViewController = ButtonOrderingView; 
    [self.view insertSubview:ButtonOrderingView.view atIndex:10];
}

When I press the button the app brakes up at this method which belongs to TTViewController.m:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
  UIViewController* popup = [self popupViewController]; //brakes up here
  if (popup) {
    return [popup shouldAutorotateToInterfaceOrientation:interfaceOrientation];
  } else {
    return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
  }
}

and the error goes like that:

[ButtonOrderingViewController popupViewController]: unrecognized selector sent to instance

Checked to see Three20 Class Hierarchy and TTViewController is a UIViewController subclass.

popupViewController is a TTPopViewController (and its subclasses) method! Which I'm not using nor do TTCatalog tutorial app. I'm lost. Any help will be appreciated.

Thanks.

+3  A: 

Had the same issue and found the error!

This is what happens when you forget to add -ObjC and/or -all_load to Other Linker Flags according to the Three20 setup instructions. Could be that you added them to the project level, and have an overriding setup at a lower level - that was the case for me.

eliego
Note that this is a pretty common problem any time you're using a 3rd-party static library that was written in Objective-C. You can get more info on what these flags do by going to http://developer.apple.com/mac/library/qa/qa2006/qa1490.html.To quote: "The -ObjC flag causes the linker to load every object file in the library that defines an Objective-C class or category. [...] The -all_load flag forces the linker to load all object files from every archive it sees, even those without Objective-C code."
Clint Harris
A: 

Added -ObjC and -all_load linker flags and everything started working. Thanks!

Justin Kent