LLucas
LLucas
TSDThe Swift Den
Created by LLucas on 10/4/2023 in #swift-development
com.accounts.iTunes error
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?
7 replies
TSDThe Swift Den
Created by LLucas on 10/4/2023 in #swift-development
com.accounts.iTunes error
It is the very first call to an Media Player function and an error occurs.
7 replies
TSDThe Swift Den
Created by LLucas on 10/4/2023 in #swift-development
com.accounts.iTunes error
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
}
}
}
}
7 replies