0
私はオーディオベースのアプリケーションを実装しています。その中で私は2つのAVPlayersを使って2つの異なるサウンドを演奏しています。私はいったん演奏されたら、別の行動をする必要があります。このため私はNSNotificationsを使用しました。しかし、私の問題は、どのプレイヤーに関連する通知を見つけることができないということです。私の通知コードとセレクターコードは次の通りです。予めNSNotificationCenter with arguments
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playingItemDidEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:iPodPlayer];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playingItemDidEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:applicationPlayer ];
- (void)playingItemDidEnd:(NSNotification *)notification
{
id object= [notification object];
if(object==ipodPlayer)
{
printf("\n Notification from iPod Player ");
}
else if(object==applicationPlayer)
{
printf("\n Notification from application Player ");
}
}
おかげで、 チャンドラ。