Open amiantos opened 6 years ago
Hi, I have a similar issue with the canMakeNextRequest
but while searching. However the getMyFollowedArtists canMakeNextRequest
does work for me.
This is a code snippet I use, just call it the first time with getFollowing(after: nil)
:
func getFollowing(after: String?) -> Void {
_ = Spartan.getMyFollowedArtists(limit: 50, after: after, success: { (pagingObject) in
/* do something with the object e.g. your code:
self.artists = pagingObject
self.printArtists()
self.fetchAllItems()
*/
if pagingObject.canMakeNextRequest {
// (optional) sleep 100ms
usleep(100000)
self.getFollowing(after: pagingObject.cursors?.after)
}
}, failure: { (error) in
print(error)
// TODO error handling
})
}
@tomaculum thank you! This is clearly a workaround for a faulty .getNext()
method, but it works and for that I am very grateful. I'm going to keep this issue open. A million thank yous!
I'm trying to use
if object.canMakeNextRequest
to get all possible artists returned bygetMyFollowedArtists
however the second request doesn't appear to be returning an object with any items in it. I've tested my code with thegetMyTopArtists
method and it works properly. I've also manually changed the limit ongetMyFollowedArtists
to ensure that the API will return more than the default limit, and it does.Here's a sample of my code just to see what I am doing.
Sample output:
What I'd expect to happen is the what happens if I use the
getMyTopArtists
method like so... changed code following way:Output: