48 items
Certificate Pinning Fallback Flaw
Code QuizHTTP/2, Pinning & Radio Cost
QuizRetry Loop Ignores Cancellation
Code QuizResilient Retry & Idempotency Design
QuizRetrying Authenticated Requests
Code QuizRetrying Requests on Flaky Networks
QuizFetching JSON With URLSession dataTask
Code QuizFetching REST Data with URLSession
QuizMobile Transport & Security Deep Dive
Slides / VideoResilient Networking Design
Slides / VideoREST Fetching with URLSession
Slides / VideoMobile Transport & Security Tradeoffs
FlashcardResilient Networking Design with URLSession
FlashcardREST Data Fetching in iOS
FlashcardLoading, Error, and Empty States
Code QuizHandling UI States for Network Calls
QuizAsync REST Call with URLSession
Code QuizAsync REST Calls with URLSession
QuizLoading, Error & Empty States
Slides / VideoREST Calls with Async/Await
Slides / VideoLoading, Error & Empty States
FlashcardREST Calls with async/await
FlashcardRetry Loop Swallows Cancellation
Code QuizResilient HTTP Retries and Backoff
QuizNetwork Reliability: Retries, Timeouts & Connectivity
Slides / VideoNetwork Reliability Basics
FlashcardResilient HTTP on Flaky Networks
Slides / VideoResilient HTTP on Flaky Networks
FlashcardAuth Header and Flaky Connection Config
Code QuizAuth Tokens & Timeouts in URLSession
QuizURLSession Fetch With Loading State
Code QuizHandling Loading and Error States in URLSession
QuizAuth Tokens & Resilient Networking
Slides / VideoURLSession Requests & Loading States
Slides / VideoAuth Tokens & Resilient Requests
FlashcardURLSession Requests & Loading/Error States
FlashcardHandling URLSession Errors Safely
Code QuizDetecting Network Failures
QuizFetching JSON with URLSession
Code QuizChecking HTTP Status Codes
QuizLoading, Errors & Flaky Networks
Slides / VideoREST APIs with URLSession Basics
Slides / VideoHandling Loading, Errors & Flaky Networks
FlashcardREST Requests with URLSession
FlashcardURLSession Errors & Retry Resilience
Slides / VideoREST Calls with URLSession & Async
Slides / VideoHandling Network Errors & Retries
FlashcardREST Calls & Async Responses in URLSession
FlashcardRetrying Authenticated Requests
Spot the bug in a URLSession helper that retries an authenticated request on flaky connections.
func fetchProfile(token: String, retries: Int = 3) {
var request = URLRequest(url: URL(string: "https://api.example.com/profile")!)
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
print("Request failed: \(error.localizedDescription)")
if retries > 0 {
fetchProfile(token: token, retries: retries)
}
return
}
guard let data = data else { return }
print("Got \(data.count) bytes")
}
task.resume()
}This helper is meant to retry up to 3 times on a flaky connection. What is the bug?