SIGABRT'堆栈中没有足够的帧'

时间:2011-12-22 06:35:11

标签: iphone ios frames sigabrt

我的应用程序似乎无法找到选择器(submitScore :)但我已经声明了它

这里:

 @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];

每当我按下其中一个按钮时,我都会收到此错误:

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”.

我尝试了其他主题的解决方案,比如弱链接lib,但我仍然遇到了这个错误。

我该怎么办?我该如何删除SIGABRT?

感谢

2 个答案:

答案 0 :(得分:1)

格式字符串需要三个值,并且只有两个

NSString *request_url = [NSString stringWithFormat: @"http://192.168.18.8/lboard/addrank.php?did=%@&sre=%@&nme=%@&fmt=jsn",
                         currentScore, currentPlayer];

答案 1 :(得分:1)

您已将myButton1的选择器指定为签名为- (void)submitScore:(id)sender的方法,而实际上您的方法签名为- (void)submitScore

将选择器设置为myButton1@selector(submitScore)