Post

Replies

Boosts

Views

Activity

How to start playback of System Music Player?
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.
6
0
2.9k
Sep ’21
How to make a playlist public/create a public playlist?
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)
1
0
2.4k
Aug ’21
How to fetch next batch of albums for an Artist?
Hello, I am fetching and displaying the .fullalbums for an Artist through the MusicKit api. The JSON response returned has a hasNextBatch: true value, but I am unsure how to fetch and display the next batch. Is this something that can be intelligently retrieved though some MusicKit functionality or does one have to perform another data request to fetch the next batch?
2
0
1.2k
Aug ’21
How to decode the JSON response from MusicKit Search Suggestion
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" } ] } }
5
0
3.1k
Jul ’21
Group Activity stopped working with iOS 15 Beta 2
Hey everyone, I had a sample app I was working on with the first beta which had SharePlay/Group Activity working fine. Beta 2 seems to have broken it. It doesn't trigger any activity. I even tried deleting and reinstalling the app, but that doesn't seem to fix the issue either. Console error print:  Dropping activity as there is no active conversation Any ideas how to fix this issue?
1
0
1.4k
Jun ’21
iOS14: Found nil while implicitly unwrapping optional
Hello, I am running my app written using SwiftUI on iOS 14 and the app crashes because of unexpectedly nil while unwrapping optional. This occurs when I try to share an image using its local URL in the Share Sheet. The puzzling part is that that it works perfectly on iOS 13. I am still new to development, so any help will be appreciated! Thanks in advance. struct ContentView: View {         @State private var imageURL: URL? @State private var isShareSheetPresented = false                  var body: some View {             ScrollView(.vertical) {                 VStack{                     Text("Test")             }             .navigationBarItems(trailing: Button(action: {                 writeImageToDisk()                 isShareSheetPresented.toggle()             }) {                 Image(systemName: "square.and.arrow.up")             }.sheet(isPresented: self.$isShareSheetPresented) {                 ShareSheet(photo: imageURL!)             })         }         func writeImageToDisk() {             imageURL = (UIApplication.shared.windows[0].rootViewController?.view!.getImage())! print(imageURL!)         } } // getImage is a function that returns an URL // imageURL is always getting printed successfully // Here is a sample of print(imageURL!) from console: file:///var/mobile/Containers/Data/Application/740E2665-8D68-4864-9E48-99E4E25D2985/Documents/Test%20Image.png // struct ShareSheet: UIViewControllerRepresentable {     let photo: URL                func makeUIViewController(context: Context) -> UIActivityViewController {         let activityItems: [Any] = [photo]                  let controller = UIActivityViewController(             activityItems: activityItems,             applicationActivities: nil)                  return controller     }            func updateUIViewController(_ vc: UIActivityViewController, context: Context) {     } }
3
0
2.3k
Sep ’20