Search code examples
iosswiftmpmedialibrary

Getting MPMediaPlaylist last modified date


Looking for a way to get the last modified date of music playlists.This is how I get the playlists and trying to get the property value:

if let playlists = MPMediaQuery.playlists().collections as? [MPMediaPlaylist] {
        for playlist in playlists {
            let date = playlist.value(forProperty: "modificationDateTime") as? Any
            print(date)
        }
} 

Property is from the class header: https://github.com/xybp888/iOS-Header/blob/master/13.0/PrivateFrameworks/MusicLibrary.framework/MIPPlaylist.hAny date property returns nil, other properties, such as "cloudGlobalID", works fine.

Any help would be much appreciated.


Solution

  • dateModified property returns the date I was looking for. dateCreated also returns when the playlist was created or added (for Apple Music playlists) to the library.