我的應用程序不能似乎找到選擇(submitScore :)但我已經宣佈它SIGABRT「在堆棧不夠框架」
這裏:
@interface Highscores (Private)
- (void)loadCurrentPlayer;
- (void)loadHighscores;
- (void)updateHighscores;
- (void)saveCurrentPlayer;
- (void)saveHighscores;
- (void)button1Callback:(id)sender;
- (void)button2Callback:(id)sender;
-(void)button3Callback:(id)sender;
-(void)submitScore:(id)sender;
-(void)viewBoard:(id)sender
@end
然後它被稱爲在這裏:
UIButton *mybutton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
mybutton1.frame=CGRectMake(80, 50, 150, 40);
[mybutton1 setTitle:@"Submit Score" forState:UIControlStateNormal];
[mybutton1 addTarget:self action:@selector(submitScore:) forControlEvents:UIControlEventTouchUpInside];
UIButton *mybutton2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
mybutton2.frame=CGRectMake(80,100,150,40);
[mybutton2 setTitle:@"View Leaderboard" forState:UIControlStateNormal];
[mybutton2 addTarget:self action:@selector(viewBoard:) forControlEvents:UIControlEventTouchUpInside];
[myView addSubview:mybutton1];
[myView addSubview:mybutton2];
[myView release];
}
-(void)submitScore
{
NSString *request_url = [NSString stringWithFormat: @"http://192.168.18.8/lboard/addrank.php?did=%@&sre=%@&nme=%@&fmt=jsn",
currentScore, currentPlayer];
NSURL *url = [NSURL URLWithString:request_url];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
request.delegate=self;
[request setDidFinishSelector:@selector(requestFinished:)];
[request setDidFailSelector:@selector(requestFailed:)];
[request startAsynchronous];
每當我按了2個按鈕中的一個,我得到這個錯誤:
2011-12-22 14:27:32.462 tweejump[5381:707] -[Highscores submitScore:]: unrecognized selector sent to instance 0x267970
2011-12-22 14:27:32.469 tweejump[5381:707] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Highscores submitScore:]: unrecognized selector sent to instance 0x267970'
terminate called throwing an exceptionProgram received signal: 「SIGABRT」.
我嘗試了其他主題的解決方案,例如弱鏈接庫,但我仍然得到該錯誤。
我還應該做什麼?我如何刪除SIGABRT?
感謝
那麼我該怎麼做 – NoobMe 2011-12-22 06:41:50
當你創建myButton1時,從'@ selector'的方法簽名中刪除冒號。 – 2011-12-22 06:44:50
O_O現在即時得到這個錯誤'目標的遠程移動/tmp/.XcodeGDBRemote-191-70 切換到遠程MacOSX的協議 MEM爲0x1000 0x3fffffff緩存 MEM 0x40000000之後的0xffffffff沒有 MEM 00000000 0x0fff沒有 運行 運行... [切換到線程7171] [切換到線程7171] sharedlibrary apply-load-rules全部 繼續 編程接收信號:「EXC_BAD_ACCESS」。 /Developer_2/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/usr/lib/dyld'已更改;重新閱讀符號。 數據格式化程序暫時不可用,將在「繼續」後重新嘗試。 (目前不安全致電dlopen。) kill quit' – NoobMe 2011-12-22 06:46:17