3

曲配列を 1 つずつ再生するように設定しました。次に、以下に説明するメソッドを呼び出します。

[[NSNotificationCenter defaultCenter] addObserver:self 
                                             selector:@selector(moviePlayerPlaybackStateChanged:) 
                                                 name:MPMoviePlayerPlaybackStateDidChangeNotification
                                               object:player];

-(void) moviePlayerPlaybackStateChanged:(NSNotification*) sender
{
    NSLog(@"in state changed = %d and isPause = %d", player.playbackState, isPause);
    if (player.playbackState == MPMoviePlaybackStatePlaying) {
        [activityIndicator stopAnimating];
    }

    if (player.playbackState == MPMoviePlaybackStateInterrupted) {
        isPause =YES;
    }
}

5 曲または 6 曲を再生すると、アプリがクラッシュし、最後のログ値は次のようになります。

2012-04-18 15:54:45.026 SymphonyProject[2896:207] in state changed = 1 and isPause = 0
2012-04-18 15:54:45.027 SymphonyProject[2896:207] in state changed = 2 and isPause = 0
[Switching to process 2896 thread 0x603b]
[Switching to process 2896 thread 0x603b]
sharedlibrary apply-load-rules all

and go to the file objc_mesgSend and pointing the line:
0x0164a09b  <+0015>  mov    0x8(%edx),%edi

エラーが発生しませんか?私を助けてください。

4

1 に答える 1

0

1つの質問、playerオブジェクトにmoviePlayerPlaybackStateChanged直接アクセスします-それはクラスプロパティですか?この通知を使用してオブジェクトを送信するため、ディクショナリplayerからオブジェクトを取得して取得する必要があります。sender.userInfo

于 2012-08-04T00:41:15.180 に答える