I need to access to user's iTunes library. I want to list all songs besides playlists and albums that a user has purchased from iTunes Store or add to his library from Apple Music or synchronized and loaded from its computer. I use MPMediaQuery
to retrieve the list. Everything looks working fine except that I am getting an error when I run the code below:
2019-12-10 12:55:01.098885+0300 AppName[11292:2511243] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-12-10 12:55:01.101918+0300 AppName[11292:2511243] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-12-10 12:55:01.124897+0300 AppName[11292:2511243] [core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
2019-12-10 12:55:01.125093+0300 AppName[11292:2511243] [iTunesCloud] [ICUserIdentityStore] Failed to fetch local store account with error: Error Domain=com.apple.accounts Code=9 "(null)".
Code works fine and lists everything that I have on my library including items that I have purchased from iTunes Store. I am trying hard to understand why it prints an error even it is working.
let myPlaylistQuery = MPMediaQuery.playlists()
let playlists = myPlaylistQuery.collections
for playlist in playlists! {
print(playlist.value(forProperty: MPMediaPlaylistPropertyName)!)
let songs = playlist.items
for song in songs {
let songTitle = song.value(forProperty: MPMediaItemPropertyTitle)
print("\t\t", songTitle!)
}
}