Post

Replies

Boosts

Views

Activity

MusicLibrary.shared.createPlaylist adds wrong track to playlist
I’ve been trying to debug an issue where tracks in playlists created using the new MusicLibrary.shared.createPlaylist function seem to be missing their artwork. For example: I’ve found that when I look at the track which MusicKit added in the above example, it’s not the one which I specified - it’s a different version (catalogId) of the same song. Interestingly it also seems to be marked as a library track (the track is definitely not in my library). Here is the code: let request = MusicCatalogResourceRequest<Song>(matching: \.id, equalTo: MusicItemID("1440800296")) let response = try await request.response() let initialCatalogId = response.items.first?.id.rawValue ?? "?" let playlist = try await MusicLibrary.shared.createPlaylist(name: "My Playlist", description: nil, authorDisplayName: "My App", items: response.items) while true {     guard let entry = try? await playlist.with([.entries], preferredSource: .library).entries?.first else {         continue     }     // This is just for debug purposes to work out what track actually got added:     let data = try JSONEncoder().encode(entry.playParameters)     guard let root = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {         continue     }     let newCatalogId = root["catalogId"] as? String ?? "?"     let isLibrary = root["isLibrary"] as? Bool ?? false     print(initialCatalogId, newCatalogId, isLibrary)     // Prints: 1440800296 309186793 true     break } If I’m doing something wrong either when saving the playlist or retrieving the catalogId of the track which was saved please let me know: I confess I’m finding it quite hard to navigate MusicKit Swift at the moment as examples & documentation seem quite thin on the ground. However if the above behaviour is the best I can expect then it’s a serious issue for me - the catalogId of the track I want to add, above, was carefully selected so if MusicKit is going to randomly swap this out then I can’t use it. I’ve created FB11589088 for this issue. @JoeKun, @david-apple: I’ve raised a number of issues with MusicKit on here recently and have received no responses at all. Appreciate you guys are really busy but I think a little help here would go a long way to making MusicKit the success it deserves to be. Please let me know if I should be doing this differently. Thanks!
0
0
1.9k
Sep ’22
MPMediaLibrary.default().addItem broken in macOS 13.4 / Catalyst
The following line of code worked fine in macOS 13.3 / Catalyst: try await MPMediaLibrary.default().addItem(withProductID: "1678639572") Since the 13.4 update it now throws an error: The operation couldn’t be completed. (MPErrorDomain error 11.) Although the Apple Music track with catalog Id 1678639572 does seem to get added to the library regardless. MPError.errorCode 11 is an undocumented value. Can someone please advise what error code 11 actually means, and if there's a workaround? I've raised this as feedback id FB12196635.
0
0
959
May ’23
How to stop promoting my IAP?
Hi. My app has a single IAP which I currently promote separately on the App Store, as well as allowing purchase in-app. My app currently implements the paymentQueue delegate method which makes the separate promotional listing possible. I want to stop separately promoting my IAP, leaving my app as the only way to purchase the IAP in future. How can I remove the separate listing for my IAP on the App Store? Can I simply delete the promotional artwork for the IAP in App Store Connect? Do I need to release a new binary which no longer supports the paymentQueue delegate? Can I simply unselect “This promotion will be shown to all app store users…” in App Store Visibility and not bother to implement the SKProductStorePromotionController update visibility delegate? Please advise! Thanks in advance.
0
0
494
Mar ’24
How can I find the user's "Favorite Songs" playlist?
It sounds simple but searching for the name "Favorite Songs" is a non-starter because it's called different names in different countries, even if I specify "&l=en_us" on the query. So is there another property, relationship or combination thereof which I can use to tell me when I've found the right playlist? Properties I've looked at so far: canEdit: will always be false so narrows things down a little inFavorites: not helpful as it depends on whether the user has favourite the favourites playlist, so not relevant hasCatalog: seems always true so again may narrow things down a bit isPublic: doesn't help Adding the catalog relationship doesn't seem to show anything immediately useful either. Can anyone help? Ideally I'd like to see this as a "kind" or "type" as it has different properties to other playlists, but frankly I'll take anything at this point.
0
0
270
Jul ’25