You need to perform async request to get completed tracks:
Objective-c:
- (void)loadTracks {
[[RPEntry instance].api getTracksWithOffset:0 limit:100 completion:^(id response, NSError *error) {
if (error != nil) {
return;
}
if (![response isKindOfClass:[RPFeed class]]) {
return;
}
RPFeed *feed = response;
NSArray <RPTrackProcessed *> *tracks = feed.tracks;
dispatch_async(dispatch_get_main_queue(), ^{
/// Implement updating your ViewController with new data
});
}];
}
Swift:
func loadTracks() {
RPEntry.instance().api.getTracks(0, limit: 100) { (response, error) in
if let feed = response as? RPFeed {
let tracks = feed.tracks;
DispatchQueue.main.async {
/// Implement updating your ViewController with new data
}
}
if (error != nil) {
DispatchQueue.main.async {
/// Implement alert or logging
}
}
}
}