单击按钮时应用程序会终止进程

发布于 2024-11-03 15:53:30 字数 7618 浏览 1 评论 0原文

基本上我已经从另一个应用程序创建了一个音板应用程序。但是我不断收到同样的错误,我不明白出了什么问题。我对 xcode 很陌生,并且我在互联网上搜索过帮助。我将发布可能需要的所有信息,并希望能够使其正常工作。

## 错误报告 ##

2011-04-27 00:37:01.437 SoundBoard[11613:207] -[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0
2011-04-27 00:37:01.440 SoundBoard[11613:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x02553b99 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x026a340e objc_exception_throw + 47
    2   CoreFoundation                      0x025556ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x024c52b6 ___forwarding___ + 966
    4   CoreFoundation                      0x024c4e72 _CF_forwarding_prep_0 + 50
    5   UIKit                               0x002b27f8 -[UIApplication sendAction:to:from:forEvent:] + 119
    6   UIKit                               0x0033dde0 -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x00340262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    8   UIKit                               0x0033ee0f -[UIControl touchesEnded:withEvent:] + 458
    9   UIKit                               0x002d63d0 -[UIWindow _sendTouchesForEvent:] + 567
    10  UIKit                               0x002b7cb4 -[UIApplication sendEvent:] + 447
    11  UIKit                               0x002bc9bf _UIApplicationHandleEvent + 7672
    12  GraphicsServices                    0x02e33822 PurpleEventCallback + 1550
    13  CoreFoundation                      0x02534ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    14  CoreFoundation                      0x02495807 __CFRunLoopDoSource1 + 215
    15  CoreFoundation                      0x02492a93 __CFRunLoopRun + 979
    16  CoreFoundation                      0x02492350 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x02492271 CFRunLoopRunInMode + 97
    18  GraphicsServices                    0x02e3200c GSEventRunModal + 217
    19  GraphicsServices                    0x02e320d1 GSEventRun + 115
    20  UIKit                               0x002c0af2 UIApplicationMain + 1160
    21  SoundBoard                          0x00001b30 main + 102
    22  SoundBoard                          0x00001ac1 start + 53
)
terminate called after throwing an instance of 'NSException'
## HBFS VIEW CONTROLLER .M ##

import "HBFSViewController.h"
import <AVFoundation/AVAudioPlayer.h>

@implementation HBFSViewController

- (IBAction)pushAbout {

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"About" message:@"The Mr Dolan Soundboard : Created by Charlie Gilbertson" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
    [alert show];
    [alert release];

}

- (IBAction)pushAnd {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"And" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];    

}

- (IBAction)pushLad {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Lad" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushNoLegs {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"No legs" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushMyDaughter {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"My Daughter" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushLass {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Lass" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushYO {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"YO" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushTape {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Tape" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];    

}

- (IBAction)pushMySon {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"My Son" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushNoArms {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"No arms" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushCanDo {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Can do better than you" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushOr {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Or" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushScotch {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Scotch" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushAndThey {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"And they've got" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushEgg {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Egg" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}
@end


## HBFS VIEW CONTROLLER .H ##

import <UIKit/UIKit.h>
import <Foundation/Foundation.h>
import <AVFoundation/AVAudioPlayer.h>

@interface HBFSViewController :UIViewController <AVAudioPlayerDelegate> {
    IBOutlet UIBarButtonItem *aboutButton;
    IBOutlet UIToolbar *toolBar;
}
- (IBAction)pushAbout;
- (IBAction)pushAnd;
- (IBAction)pushLad;
- (IBAction)pushLass;
- (IBAction)pushOr;
- (IBAction)pushScotch;
- (IBAction)pushTape;
- (IBAction)pushYO;
- (IBAction)pushEgg;
- (IBAction)pushNoLegs;
- (IBAction)pushNoArms;
- (IBAction)pushMyDaughter;
- (IBAction)pushMySon;
- (IBAction)pushCanDo;
- (IBAction)pushAndThey;
@end

Basically I've created a soundboard app from another app. However i keep getting the same error and I can't understand whats wrong. I'm quite new to xcode and I've searched all over the internet for help. I'll post all information which maybe required and hopefully can get this working.

## The Error Report ##

2011-04-27 00:37:01.437 SoundBoard[11613:207] -[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0
2011-04-27 00:37:01.440 SoundBoard[11613:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0'
*** Call stack at first throw:
(
    0   CoreFoundation                      0x02553b99 __exceptionPreprocess + 185
    1   libobjc.A.dylib                     0x026a340e objc_exception_throw + 47
    2   CoreFoundation                      0x025556ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
    3   CoreFoundation                      0x024c52b6 ___forwarding___ + 966
    4   CoreFoundation                      0x024c4e72 _CF_forwarding_prep_0 + 50
    5   UIKit                               0x002b27f8 -[UIApplication sendAction:to:from:forEvent:] + 119
    6   UIKit                               0x0033dde0 -[UIControl sendAction:to:forEvent:] + 67
    7   UIKit                               0x00340262 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
    8   UIKit                               0x0033ee0f -[UIControl touchesEnded:withEvent:] + 458
    9   UIKit                               0x002d63d0 -[UIWindow _sendTouchesForEvent:] + 567
    10  UIKit                               0x002b7cb4 -[UIApplication sendEvent:] + 447
    11  UIKit                               0x002bc9bf _UIApplicationHandleEvent + 7672
    12  GraphicsServices                    0x02e33822 PurpleEventCallback + 1550
    13  CoreFoundation                      0x02534ff4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
    14  CoreFoundation                      0x02495807 __CFRunLoopDoSource1 + 215
    15  CoreFoundation                      0x02492a93 __CFRunLoopRun + 979
    16  CoreFoundation                      0x02492350 CFRunLoopRunSpecific + 208
    17  CoreFoundation                      0x02492271 CFRunLoopRunInMode + 97
    18  GraphicsServices                    0x02e3200c GSEventRunModal + 217
    19  GraphicsServices                    0x02e320d1 GSEventRun + 115
    20  UIKit                               0x002c0af2 UIApplicationMain + 1160
    21  SoundBoard                          0x00001b30 main + 102
    22  SoundBoard                          0x00001ac1 start + 53
)
terminate called after throwing an instance of 'NSException'
## HBFS VIEW CONTROLLER .M ##

import "HBFSViewController.h"
import <AVFoundation/AVAudioPlayer.h>

@implementation HBFSViewController

- (IBAction)pushAbout {

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"About" message:@"The Mr Dolan Soundboard : Created by Charlie Gilbertson" delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil];
    [alert show];
    [alert release];

}

- (IBAction)pushAnd {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"And" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];    

}

- (IBAction)pushLad {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Lad" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushNoLegs {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"No legs" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushMyDaughter {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"My Daughter" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushLass {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Lass" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushYO {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"YO" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushTape {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Tape" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];    

}

- (IBAction)pushMySon {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"My Son" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushNoArms {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"No arms" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushCanDo {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Can do better than you" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushOr {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Or" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushScotch {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Scotch" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushAndThey {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"And they've got" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}

- (IBAction)pushEgg {

    NSString *path = [[NSBundle mainBundle] pathForResource:@"Egg" ofType:@"aif"];
    AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
    theAudio.delegate = self;
    [theAudio play];

}
@end


## HBFS VIEW CONTROLLER .H ##

import <UIKit/UIKit.h>
import <Foundation/Foundation.h>
import <AVFoundation/AVAudioPlayer.h>

@interface HBFSViewController :UIViewController <AVAudioPlayerDelegate> {
    IBOutlet UIBarButtonItem *aboutButton;
    IBOutlet UIToolbar *toolBar;
}
- (IBAction)pushAbout;
- (IBAction)pushAnd;
- (IBAction)pushLad;
- (IBAction)pushLass;
- (IBAction)pushOr;
- (IBAction)pushScotch;
- (IBAction)pushTape;
- (IBAction)pushYO;
- (IBAction)pushEgg;
- (IBAction)pushNoLegs;
- (IBAction)pushNoArms;
- (IBAction)pushMyDaughter;
- (IBAction)pushMySon;
- (IBAction)pushCanDo;
- (IBAction)pushAndThey;
@end

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

奶茶白久 2024-11-10 15:53:30

看到这个错误消息了吗?

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0

现在查看您列出的所有 IBAction 方法(-pushAbout 等)。

您会注意到 -pushBetter 未在其中列出。

您需要编写一个 -pushBetter 方法并将其连接到 UIButton

See this error message?

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0

Now look at all the IBAction methods you've listed (-pushAbout, etc.).

You'll notice that -pushBetter is not listed among them.

You need to write a -pushBetter method and wire it up to the UIButton.

请别遗忘我 2024-11-10 15:53:30

看起来您以某种方式向您的视图控制器发送了一个pushBetter方法调用,但它显然没有准备好(根据您的代码和错误):

-[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0' 

您可以全局搜索“pushBetter”并查看它在您的位置吗项目??

It looks like you're somehow sending a pushBetter method call to your view controller which it is apparently not prepared for (according to your code and the error):

-[HBFSViewController pushBetter]: unrecognized selector sent to instance 0x693ccb0' 

Can you to a global search for "pushBetter" and see where it is in your project??

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文