运行音乐APP时出现Xcode错误

时间:2015-07-06 05:44:59

标签: ios unrecognized-selector

我正在为音乐应用程序编写一个应用程序,但是当我在模拟应用程序时单击“播放/暂停”按钮时,我会在播放/暂停按钮中出现错误。

2015-07-05 22:28:09.302 FAMusic[69479:8050942] -[ViewController PlayButtonPressed:]: unrecognized selector sent to instance 0x7ffe7402fe70
2015-07-05 22:28:09.311 FAMusic[69479:8050942] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController PlayButtonPressed:]: unrecognized selector sent to instance 0x7ffe7402fe70'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010f39bc65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010f034bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010f3a30ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010f2f913c ___forwarding___ + 988
    4   CoreFoundation                      0x000000010f2f8cd8 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x000000010cdd7d62 -[UIApplication sendAction:to:from:forEvent:] + 75
    6   UIKit                               0x000000010cee950a -[UIControl _sendActionsForEvents:withEvent:] + 467
    7   UIKit                               0x000000010cee88d9 -[UIControl touchesEnded:withEvent:] + 522
    8   UIKit                               0x000000010ce24958 -[UIWindow _sendTouchesForEvent:] + 735
    9   UIKit                               0x000000010ce25282 -[UIWindow sendEvent:] + 682
    10  UIKit                               0x000000010cdeb541 -[UIApplication sendEvent:] + 246
    11  UIKit                               0x000000010cdf8cdc _UIApplicationHandleEventFromQueueEvent + 18265
    12  UIKit                               0x000000010cdd359c _UIApplicationHandleEventQueue + 2066
    13  CoreFoundation                      0x000000010f2cf431 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    14  CoreFoundation                      0x000000010f2c52fd __CFRunLoopDoSources0 + 269
    15  CoreFoundation                      0x000000010f2c4934 __CFRunLoopRun + 868
    16  CoreFoundation                      0x000000010f2c4366 CFRunLoopRunSpecific + 470
    17  GraphicsServices                    0x00000001122c5a3e GSEventRunModal + 161
    18  UIKit                               0x000000010cdd68c0 UIApplicationMain + 1282
    19  FAMusic                             0x000000010c639d6f main + 111
    20  libdyld.dylib                       0x000000010f9c0145 start + 1
    21  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

这方面的任何帮助?我可以轻松地在其他按钮上运行操作,但每当我点击播放/暂停按钮时,我都会收到此错误消息?

以下是CODE的更新:

- (IBAction)playButtonPressed {
    [self.timer invalidate];
    //play audio for the first time or if pause was pressed
    if (!self.isPaused) {
        [self.playPauseButton setBackgroundImage:[UIImage imageNamed:@"Pause.png"]
                                   forState:UIControlStateNormal];

        //start a timer to update the time label display
        self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                                      target:self
                                                    selector:@selector(updateTime:)
                                                    userInfo:nil
                                                     repeats:YES];

        [self.audioPlayer play];
        self.isPaused = TRUE;

    } else {
        //player is paused and Button is pressed again
        [self.playPauseButton setBackgroundImage:[UIImage imageNamed:@"Play.png"]
                                   forState:UIControlStateNormal];

        [self.audioPlayer pause];
        self.isPaused = FALSE;
    }
}

0 个答案:

没有答案