Search code examples
iosnsnotificationcentermpmedialibrary

Observe Media Library changes in iOS


I would like to know if it is possible to observe Media Library changes in iOS.

I would like to be notified every time a user adds, remove or edit a Media Item (Song, Artist or Album item).

I have still not found a way to do that.


Solution

  • You can use notification MPMediaLibraryDidChange to observe the library changes. Be sure to call beginGeneratingLibraryChangeNotifications() first.

    For reference https://developer.apple.com/documentation/mediaplayer/mpmedialibrary