Hello. I have the following question. I call the nextBatch() method on MusicItemCollection to get the next collection of artist albums. Here is my method:
func allAlbums2(artist: Artist) async throws -> [Album] {
var allAlbums: [Album] = []
artist.albums?.forEach { allAlbums.append($0) }
guard let albums = artist.albums else { return [] }
var albumsCollection = albums
while albumsCollection.hasNextBatch {
let response = try await albumsCollection.nextBatch()
if let response {
albumsCollection = response
var albums = [Album]()
albumsCollection.forEach({ albums.append($0)})
allAlbums.append(contentsOf: albums)
}
}
return allAlbums
}
The problem is as follows. Sometimes it happens that some albums not in nextBatch are not returned (I noticed one, I didn't check the others). This happens once every 50-100 requests. The number of batches is returned the same when the album is skipped. The same albums are returned in the batch where the album was missed. I have a question, do I have a problem with multi-threading or something else or is it a problem in the API. The file contains prints of the returned batches. One with a missing album, the other without a missing one. There are about 3000 lines in the file. I will be grateful for a hint or an answer. Thank you!
Here link to file: https://files.fm/u/nj4r5wgyg3
Post
Replies
Boosts
Views
Activity
Hello.
I have the following question. I have a program that creates files with its own extension and reads them. When I select a file with my extension in the Files app, it automatically opens my app. But if a file with my extension is attached to an email, when I click on my file it shows me a screen with programs to open (actually it shows my program the second time I click on the file, if I click the first time, my program is not listed) . I have a question, is it possible to make the file with my extension attached to the letter immediately open in my program without additional screens or is it not allowed. If possible, then what did I miss, based on the fact that it opens immediately from the Files program.
Thank you.
P.S. File how it works below:
![]
[Image Edited by Moderator to Remove Personal Information]