views:

120

answers:

1

I am using a music player property for iPod player controller.

// .h
@property (nonatomic, retain) MPMusicPlayerController *ipodPlayer;

// .m
ipodPlayer = [MPMusicPlayerController iPodMusicPlayer];

NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];

[notificationCenter addObserver:self selector:@selector(changedPlaybackState:) name:MPMusicPlayerControllerPlaybackStateDidChangeNotification object:ipodPlayer];
[notificationCenter addObserver:self selector:@selector(changedNowPlayingItem:) name:MPMusicPlayerControllerNowPlayingItemDidChangeNotification object:ipodPlayer];

[ipodPlayer beginGeneratingPlaybackNotifications];

During background processing, if iPod player app is terminated, the console prints out:

MediaPlayer: Message playbackState timed out.

If it doesn't crash(or freezes, slowing performance), the notification is not being sent to my observing methods anymore. I can still send messages like:

[ipodPlayer pause];
[ipodPlayer play];
[ipodPlayer skipToNextItem];
[ipodPlayer skipToPreviousItem];

but can't receive any notifications

My questions are:

  1. Is there are way to reassign, reload pointers during runtime? How can I restore the property to be just like when it's first launched?
  2. How can I catch the messge:"MediaPlayer: Message playbackState timed out." in console output? This is not like using NSLog.

Thank you for helping me.

A: 

Peter,

Did you resolve this issue? i also encountered this problem.

xlpeng
Sadly, not at all. I believe this has something to do with iOS itself. Still looking for any answer to be found.
Peter SHINe 신동혁