I try to write Activator action for changing current song rating. I now that we can read MPMediaItemPropertyRating property and get rating. But how can we change it from app?
According to the iPod Library Access Programming Guide "All media item metadata is read-only.".
You can change the rating of a MPMediaItem
with the following line:
[mediaItem setValue:[NSNumber numberWithInteger:rating] forKey:@"rating"];
Works fine in iOS 7, cannot be sure for earlier versions.
@sooper's answer works for local MPMediaItems on the device. But iOS doesnt sync these to iCloud Music Library or Apple Music.
Seems there is no way to change 'Star' Ratings so they are synced to iCloud Music Library. Any setValue:forKey:
attempts change the Star Rating only locally. Such changes may be overwritten by any future iCloud Music Library sync.
We can change 'Love' Ratings of our Apple Music catalog and iCloud Music Library, using Apple Music Web APIs as pointed out by @AMGuru here.
And below is the Apple Documentation for those APIs:
https://developer.apple.com/documentation/applemusicapi/ratings
According to the iPod Library Access Programming Guide "All media item metadata is read-only.".
© 2022 - 2024 — McMap. All rights reserved.