开发者

MPMusicPlayerController stops working after iTunes sync

I know there's a similar question MPMusicPlayerController stops sending notifications, but the answer to that question doesn't solve this problem.

I'm using iOS 4, and this happens on both multitasking-enabled devices and non-multitasking devices. I've tested on iPhone 4, iPhone 3GS, iPod touch 2G, and iPod touch 1G.

I have a project just for testing this problem. It uses MPMusicPlayerController to control iPod music playback, and gets notifications when the nowPlaying item changes, so it can update the artwork, artist, and title. It works fine when you first launch it. But if you do an iTunes sync, which I believe quits the iPod.app on the device, and return to my app, the app no longer gets notifications from the MPMusicPlayerController, so it doesn't update the Now Playing Item display.

The project also lets you select a playlist from your iPod library to start playing. It also stops working after sync. It still can get a list of playlists, but trying to queue them in the iPod music player doesn't do anything.

Releasing the old instance of MPMusicPlayerController doesn't work. Unregistering and re-registering for notifi开发者_开发百科cations doesn't work. It seems to be a problem with the IPC between the app and the iPod.app. The only way to fix it is to kill my app and relaunch it.

Anybody else having this problem?


I'm having the exact same problem and haven't been able to fix it properly, though I did come up with a temporary solution that's better than leaving my app stuck in an unusable state:

I call exit(0) in my handler for MPMediaLibraryDidChangeNotification, so at least my users won't be stuck unable to do anything wondering how to fix it.


I'd try re-setting the AVAudioSession category to AVAudioSessionCategorySoloAmbient and re-activating the session.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜