Last active
December 5, 2016 03:31
-
-
Save allenlinli/2ca3ec3abb65f82e0a0b9510cfee3b0d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment