2009-09-23 7 views
0

Я создаю приложение iPhone, которое отображает UITableView в начале с некоторым текстом в ячейках. Когда пользователь отбирает ячейку, он должен перейти к другому виду. При запуске приложения в iPhone Simulator и нажмите на ячейку, я получаю следующее сообщение об ошибке:NSInvalidArgumentException

2009-09-23 12:20:03.554 ZDFMobiel[751:20b] *** Terminating app due to uncaught exception 
'NSInvalidArgumentException', reason: '*** -[RootViewController eigenRisicoView]:  
unrecognized selector sent to instance 0xd1d1a0' 
2009-09-23 12:20:03.555 ZDFMobiel[751:20b] Stack: (

Вот функция (в RootViewController.m), где произошла ошибка. Это происходит на

if(self.eigenRisicoView == nil) { 

строка или другие операторы if, в зависимости от того, какую ячейку вы нажимаете.

// Override to support row selection in the table view. 
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

ZDFMobielAppDelegate *appDelegate = (ZDFMobielAppDelegate *)[[UIApplication sharedApplication] delegate]; 
NSString *content = (NSString *)[appDelegate.menuItems objectAtIndex:indexPath.row]; 

switch (indexPath.row) { 
    case 0: 
    if(self.eigenRisicoView == nil) { 
    EigenRisicoViewController *viewController = [[EigenRisicoViewController alloc] initWithNibName:@"EigenRisicoViewController" bundle:[NSBundle mainBundle]]; 
    self.eigenRisicoView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.eigenRisicoView animated:YES]; 
    self.eigenRisicoView.title = content; 

    break; 

    case 1: 
    if(self.declaratieStatusView == nil) { 
    DeclaratieStatusViewController *viewController = [[DeclaratieStatusViewController alloc] initWithNibName:@"DeclaratieStatusViewController" bundle:[NSBundle mainBundle]]; 
    self.declaratieStatusView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.declaratieStatusView animated:YES]; 
    self.declaratieStatusView.title = content; 

    break; 

    case 2: 
    if(self.vergoedingenView == nil) { 
    VergoedingenViewController *viewController = [[VergoedingenViewController alloc] initWithNibName:@"VergoedingenViewController" bundle:[NSBundle mainBundle]]; 
    self.vergoedingenView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.vergoedingenView animated:YES]; 
    self.vergoedingenView.title = content; 

    break; 

    case 3: 
    if(self.zoekenZorgInstView == nil) { 
    ZoekenZorgInstViewController *viewController = [[ZoekenZorgInstViewController alloc] initWithNibName:@"ZoekenZorgInstViewController" bundle:[NSBundle mainBundle]]; 
    self.zoekenZorgInstView = viewController; 
    [viewController release]; 
    } 
    [self.navigationController pushViewController:self.zoekenZorgInstView animated:YES]; 
    self.zoekenZorgInstView.title = content; 

    break; 
    default: 
    break; 
} 


    // Navigation logic may go here -- for example, create and push another view controller. 
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; 
// [self.navigationController pushViewController:anotherViewController animated:YES]; 
// [anotherViewController release]; 
    } 

Это мой RootControllerView.h файл

#import "EigenRisicoViewController.h"; 
#import "DeclaratieStatusViewController.h"; 
#import "VergoedingenViewController.h"; 
#import "ZoekenZorgInstViewController.h"; 
#import "ZDFMobielAppDelegate.h"; 

@interface RootViewController : UITableViewController { 
EigenRisicoViewController *eigenRisicoView; 
DeclaratieStatusViewController *declaratieStatusView; 
VergoedingenViewController *vergoedingenView; 
ZoekenZorgInstViewController *zoekenZorgInstView; 

} 

@property(nonatomic,retain) EigenRisicoViewController *eigenRisicoView; 
@property(nonatomic,retain) DeclaratieStatusViewController *declaratieStatusView; 
@property(nonatomic,retain) VergoedingenViewController *vergoedingenView; 
@property(nonatomic,retain) ZoekenZorgInstViewController *zoekenZorgInstView; 

@end 

Я новичок в разработке iPhone, Objective C и XCode, так что я не понимаю, что значит ошибка ..

ли кто-нибудь знаете, что я делаю неправильно?

ответ

1

я должен был бы видеть всю реализацию, но это звучит, как вы штрафной @synthesize eigenRisicoView;

+0

Это была проблема ... Спасибо :) – Rick

Смежные вопросы