Posts

Post not yet marked as solved
0 Replies
778 Views
Hi Apple Engineers, I am reporting a issue that has surfaced in iOS 16.1 and iOS 16.2 beta, where when you have a long list of Tracks that are in the label of a Buttons, they are are displayed correctly. They appear intermittently, after you scroll they disappear (placeholder is shown) and it required a state change to display the final artwork correctly Here is code: let tracks = [Track] //With Issue List(tracks) { track in Button { //ACTION BLOCL } label: { if let artwork = track.artwork { ArtworkImage(artwork: artwork, width: 50, height: 50) } else { PlaceholderView() } } } //Without Issue List(tracks) { track in if let artwork = track.artwork { ArtworkImage(artwork: artwork, width: 50, height: 50) } else { PlaceholderView() } } Same code works correctly on iOS 15 and also when ArtworkImage is not used inside a button. Here is the related ticket: FB11840336
Posted Last updated
.
Post not yet marked as solved
0 Replies
560 Views
Hi Apple Engineers, I am reporting an issue in iOS 16.1 and iOS 16.2 beta 3 where setting the shuffleMode for ApplicationMusicPlayer is no longer working Here is the code: let player = ApplicationMusicPlayer.shared let tracks = [Tracks] player.queue = ApplicationMusicPlayer.Queue(for: tracks) player.state.shuffleMode = .songs Task.init { try await player.play() } I tested the same code on iOS 15 and it works as expected. Here is the related ticket: FB11840279
Posted Last updated
.
Post not yet marked as solved
1 Replies
878 Views
Hi all, I am curious about how we can use MusicKit for Swift to SharePlay music? There seems to be very little documentation around this as most of it seems top be focused on AVPlayerPlaybackCoordinator. Is there an easier way to directly integrate ApplicationMusicPlayer with GroupActivity?
Posted Last updated
.
Post marked as solved
1 Replies
1.4k Views
Hi Apple Engineers, I noticed in iOS 16, PlayParameters which part of every Track that has been added/downloaded to the library, now includes two new properties isLibrary & musicKit_persistentID . Unfortunately, these create backward compatibility error when trying to decode the Track object on iOS 15. I make collaborative playlist app, which stores the Track added by User A which now includes the unique identifier for the locally downloaded file, when attempted to be played by User B won't play any music due to mismatching identifiers (even when everyone is on iOS 16). This essentially breaks the entire functionality of my app due to these new properties. Steps: Store a Track (which has been added to library) as a JSON object from iOS 16 Decode the JSON on iOS 15 Expected Results: New PlayParameters variables should be optional, to support backwards compatibility with iOS 15 and to support collaborative uses cases. Actual Results: New PlayParameters automatically include two new values that cause decoding errors. I request that at least for an option to ignore the new properties in the PlayParameters in iOS 16. Here is my feedback: FB11362589
Posted Last updated
.
Post not yet marked as solved
0 Replies
1k Views
Hi all, I have an app where I am displaying a list of item in a view. Problem is that the main thread is often getting blocked when I start scrolling. Here is what I getting from using Profiler. I understand that CATransaction has to do with animation, but could someone help me understand in simple terms what is happening here?
Posted Last updated
.
Post not yet marked as solved
2 Replies
924 Views
Hi Apple Engineers, In my app Caset, the album artwork is no longer displaying correctly, instead the console is printing with error: [Artwork] [MPArtwork] Failed to create directory at 'file:///var/mobile/Media/iTunes_Control/iTunes/Artwork/Caches/96x96/61/' with error: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “61” in the folder “96x96”." UserInfo={NSFilePath=/var/mobile/Media/iTunes_Control/iTunes/Artwork/Caches/96x96/61, NSUnderlyingError=0x280552dc0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}} Here is the code I am using to display the album artwork of the current item: @ObservedObject private var playerQueue = ApplicationMusicPlayer.shared.queue //In the BODY switch playerQueue.currentEntry?.item {     case .song(let song):     if let artwork = song.artwork {         ArtworkImage(artwork, width: 40, height: 40)        } case .musicVideo(let video):        if let artwork = video.artwork {           ArtworkImage(artwork, width: 70, height: 40)         }                case nil:        EmptyView()  } Related bug has been filed here: FB10189431 This unexpected behavior is new and was previously worked as expected in early versions of iOS 15.
Posted Last updated
.
Post marked as solved
5 Replies
2.6k Views
Hello everyone, I am trying to understand how to decode the JSON response returned by the suggestions/top results endpoint in MusicKit As you can see the response returns suggestions, which has two different types, Albums and Songs within the same 'suggestions' array. How can I decode the response even if there are different types using a single struct? { "results" : { "suggestions" : [ { "content" : { "attributes" : { "url" : "https:\/\/music.apple.com\/us\/artist\/megan-thee-stallion\/1258989914", "name" : "Megan Thee Stallion", "genreNames" : [ "Hip-Hop\/Rap" ] }, "id" : "1258989914", "relationships" : { "albums" : { "data" : [ { "href" : "\/v1\/catalog\/us\/albums\/1537889223", "type" : "albums", "id" : "1537889223" } ], "next" : "\/v1\/catalog\/us\/artists\/1258989914\/albums?offset=25", "href" : "\/v1\/catalog\/us\/artists\/1258989914\/albums" } }, "href" : "\/v1\/catalog\/us\/artists\/1258989914", "type" : "artists" }, "kind" : "topResults" }, { "content" : { "href" : "\/v1\/catalog\/us\/artists\/991187319", "attributes" : { "genreNames" : [ "Hip-Hop\/Rap" ], "url" : "https:\/\/music.apple.com\/us\/artist\/moneybagg-yo\/991187319", "name" : "Moneybagg Yo" }, "id" : "991187319", "type" : "artists", "relationships" : { "albums" : { "href" : "\/v1\/catalog\/us\/artists\/991187319\/albums", "data" : [ { "id" : "1550876571", "href" : "\/v1\/catalog\/us\/albums\/1550876571", "type" : "albums" } ], "next" : "\/v1\/catalog\/us\/artists\/991187319\/albums?offset=25" } } }, "kind" : "topResults" } ] } }
Posted Last updated
.
Post marked as solved
6 Replies
2.3k Views
Hi all, I am trying to start the playback of the current queue in the system music player using: let player = SystemMusicPlayer.shared try await player.play() But there is no playback, what am I doing wrong? Please keep in mind that there are already songs in the queue. I am simply unable start the playback.
Posted Last updated
.
Post marked as solved
1 Replies
2.1k Views
Hey everyone, I am creating playlist via the MusicKit API and by default it creates the playlist in the users library and the isPublic attribute is set to false. Is there a way to make the playlist public at the time of creation? (Only way to change isPublic = true at this time seems to be through the Music app right now)
Posted Last updated
.
Post marked as solved
2 Replies
1.3k Views
Hello, In MusicKit I would like to know how I can detect the end of hasNextBatch for a MusicItemCollection. Let's say, I have a playlist with 100+ songs in my library. Initially, I get 100 songs from the response and hasNextBatch is true. If I use a while loop, every response includes the hasNextBatch = true. So I do not know when to stop or how many limited loop to make. Is there way I can get the playlist loaded completely with all the songs loaded using nextBatch and stop when I have hit the end?
Posted Last updated
.
Post marked as solved
2 Replies
1.2k Views
Hi all, I am playing songs via ApplicationMusicPlayer with MusicKit for Swift and I am running into an issue where shuffle mode is sometimes automatically turned on. Even though there was no code related to shuffle mode. Here's a snippet //myQueue is an array of Tracks let player = ApplicationMusicPlayer.shared player.queue = ApplicationMusicPlayer.Queue(for: myQueue) // player.state.shuffleMode = .off // I tried explicitly setting shuffle mode off, which has no effect try await player.play() This issue is not easily reproducible, it occurs rarely and at random. But once this issue occurs it persists even after uninstalling and reinstalling the app. When I tried it to reproduce it with another device and everything works properly. Anyone else running into this issue? For Apple Engineers, here is the ticket: FB9816030
Posted Last updated
.
Post marked as solved
1 Replies
1.3k Views
Hello, I am trying to get recommendations based on the identifier of multiple tracks. But I am unable to get any results Here is the code I have used to try to get recommendations based on one album let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: URL(string: "https://api.music.apple.com/v1/me/recommendations/1571344275")!)) let dataResponse = try await dataRequest.response() For this I am getting the response: Failed to perform MusicDataRequest.Context(   url: https://api.music.apple.com/v1/me/recommendations/1571344275,   currentRetryCounts: [.other: 1] ) with MusicDataRequest.Error(   status: 404,   code: 40400,   title: "Resource Not Found",   detailText: "Resource with requested id was not found", I have tried used the identifier of songs/albums, to no success. What am I doing wrong?
Posted Last updated
.
Post marked as solved
3 Replies
903 Views
Hi all, I ma displaying the Music Subscription offer sheet in my app. Shortly after the sheet is presented, when the user dismisses the offer, the app crashes with error: Fatal error: CloudServiceSetupView.makeUIViewController() was called with an unexpected presentation state: idle. 2021-11-30 11:56:28.974626-0800 AppName[16276:4525658] _MusicKit_SwiftUI/CloudServiceSetupView.swift:31: Fatal error: CloudServiceSetupView.makeUIViewController() was called with an unexpected presentation state: idle. What am I doing wrong? Related Ticket for Apple Engineers: FB9789040
Posted Last updated
.