6

我需要访问用户的 iTunes 库。我想列出用户从 iTunes Store 购买或从 Apple Music 添加到他的资料库或从其计算机同步和加载的播放列表和专辑之外的所有歌曲。我MPMediaQuery用来检索列表。一切看起来都很好,只是在运行以下代码时出现错误:

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)".

代码运行良好,并列出了我的资料库中的所有内容,包括我从 iTunes Store 购买的项目。我正在努力理解为什么即使它正在工作它也会打印错误。

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!)
            }
        }
4

0 回答 0