static NSInteger const maxRetryCountForFetchingTicket = 10;
- (void)_handleFetchTicketFailWithError:(NSError *)inError petID:(NSString *)inPet
{
if ([inError code] == KKInvalidSessionError) {
//error handling
return;
}
retryCount ++;
if (retryCount == maxRetryCountForFetchingTicket) {
retryCount = 0;
//retry count run out, handle error
return;
}
// _fetchPetContentWithSongID is the API call.
[self performSelector:@selector(_fetchPetContentWithPetID:) withObject:inPetID afterDelay:2.0];
}
- (void)_fetchPetContentWithSongID:(NSString *)inPetID
{
// use NSURLSession or NSURLConnection to make API call.
}