com.accounts.iTunes error

I am trying to implement some MediaPlayer and MusicKit features. Anyone know how I fix this bug on com.accounts.iTunes authentication error?
2 Replies
outsharded
outsharded12mo ago
What bug? Code? Give more information
LLucas
LLucas12mo ago
Here is the error message:
1st error: <ICMonitoredAccountStore: 0x2835bc780> Failed to register for account monitoring. err=Error Domain=com.apple.accounts Code=7 "(null)"

2nd error: [ICUserIdentityStore] Failed to fetch local store account with error: Error Domain=com.apple.accounts Code=7 "(null)"

3rd error: Attempted to register account monitor for types client is not authorized to access: {(
"com.apple.account.iTunesStore"
)}
1st error: <ICMonitoredAccountStore: 0x2835bc780> Failed to register for account monitoring. err=Error Domain=com.apple.accounts Code=7 "(null)"

2nd error: [ICUserIdentityStore] Failed to fetch local store account with error: Error Domain=com.apple.accounts Code=7 "(null)"

3rd error: Attempted to register account monitor for types client is not authorized to access: {(
"com.apple.account.iTunesStore"
)}
Here is the code:
func updateSongs() {
SKCloudServiceController.requestAuthorization{ status in
if status == .authorized {
print("skcloud service good:)")
let songsQuery = MPMediaQuery.songs() //<--- error triggered here
if let songs = songsQuery.items {
let desc = NSSortDescriptor(key: MPMediaItemPropertyLastPlayedDate, ascending: false)
let sortedSongs = NSArray(array: songs).sortedArray(using: [desc])

Model.shared.librarySongs = sortedSongs as! [MPMediaItem]
}

let playlistQuery = MPMediaQuery.playlists()
if let playlists = playlistQuery.collections {
Model.shared.playlist = playlists
}
}
}
}
func updateSongs() {
SKCloudServiceController.requestAuthorization{ status in
if status == .authorized {
print("skcloud service good:)")
let songsQuery = MPMediaQuery.songs() //<--- error triggered here
if let songs = songsQuery.items {
let desc = NSSortDescriptor(key: MPMediaItemPropertyLastPlayedDate, ascending: false)
let sortedSongs = NSArray(array: songs).sortedArray(using: [desc])

Model.shared.librarySongs = sortedSongs as! [MPMediaItem]
}

let playlistQuery = MPMediaQuery.playlists()
if let playlists = playlistQuery.collections {
Model.shared.playlist = playlists
}
}
}
}
It is the very first call to an Media Player function and an error occurs. Is error Code=7 a token issue? If so, what dev token do i need? Am I supposed to have some sort of access to iTunesStore separately?
Want results from more Discord servers?
Add your server