2012-04-23 13 views
0

私はセルをタップしたいテーブルがあり、それは私を別のテーブルに連れて行きます。 Xcodeの4.3.2で実行中に が、私はこのエラーを得た:シグナルSIGABRT in Xcode

return UIApplicationMain(argc, argv, nil, NSStringFromClass([RanchForecastTouchAppDelegate class])); 

Thread 1: Signal SIGABRT 

私はこのフォーラムでは、このエラーに関連する答えをたくさん見ましたが、それはうまくいきませんでした、それは私が再び質問をした理由です。

私のコードは次のとおりです。コンソール上 CreateViewController.h

#import <UIKit/UIKit.h> 

@interface CreateViewController : UIViewController < 
UITableViewDataSource, UITableViewDelegate> 
{ 
NSArray *tableData; 

} 

@property (nonatomic, retain) NSArray *tableData; 
@end 

CreateViewController.m

#import "CreateViewController.h" 

@implementation CreateViewController 
@synthesize tableData; 


#pragma mark - View lifecycle 

- (void)viewDidLoad 
{ 
tableData = [[NSArray alloc] initWithObjects:@"Johan", @"Paul",@"George",@"Ringo", nil]; 
[super viewDidLoad]; 
// Do any additional setup after loading the view. 
} 

#pragma mark - TableView Data Source methods 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; 
{ 
return [tableData count]; 

} 


    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 
{ 
UITableViewCell *cell = nil; 

cell = [tableView dequeueReusableCellWithIdentifier:@"MyCell"]; 
if(cell == nil) 
{ 
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MyCell"]; 

} 
cell.textLabel.text = [tableData objectAtIndex:indexPath.row]; 

return cell; 
} 


@end 

エラーメッセージ:

[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x68ab4d0

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x68ab4d0'

編集:

#import "RanchForecastTouchViewController.h" 

@interface RanchForecastTouchViewController() 

@end 

@implementation RanchForecastTouchViewController 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
// Do any additional setup after loading the view, typically from a nib. 
} 

- (void)viewDidUnload 
{ 
[super viewDidUnload]; 
// Release any retained subviews of the main view. 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) { 
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown); 
} else { 
    return YES; 
} 
} 

@end 

RanchForecastTouchViewController.h

#import <UIKit/UIKit.h> 

@interface RanchForecastTouchViewController : UIViewController 

@end 

答えて

0

ユーザーインターフェイスをチェック接続、それはいくつかの間違った接続のため!

0

あなたがライン

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; 
{ ... 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 
{.... 
} 

の最後にセミコロンを追加しただけでそれらを削除

+0

Obj-Cではこれが問題になることはほとんどありません。 – Jasarien

+0

@チャカラカ問題 - >> [UIViewController tableView:numberOfRowsInSection:]:インスタンスに送信された認識不能セレクタ0x6854510 –

+0

return UIApplicationMain(argc、argv、nil、NSStringFromClass([RanchForecastTouchAppDelegate class])); スレッド1:Signal SIGABRT –

関連する問題