Networking & URLSession
URLSession, HTTP requests, data tasks, upload, download, error handling, async/await
1What is the main difference between URLSession.shared and a custom URLSession instance?
What is the main difference between URLSession.shared and a custom URLSession instance?
คำตอบ
URLSession.shared is a global singleton with default configuration, ideal for simple requests. A custom instance allows configuring behavior (timeouts, caching, delegates) for specific needs. Using a custom instance provides fine-grained control over cache policies, SSL certificates, and redirections.
2What is the main role of the URLRequest class?
What is the main role of the URLRequest class?
คำตอบ
URLRequest encapsulates HTTP request parameters: URL, HTTP method (GET, POST, etc.), custom headers, timeout, request body, and cache policies. It allows precise configuration of how a request should be sent before passing it to URLSession.
3When to use HTTP POST method instead of GET in a URLRequest?
When to use HTTP POST method instead of GET in a URLRequest?
คำตอบ
Use POST to send sensitive data (passwords, tokens), large data volumes, or operations that modify server state. GET is suitable for retrieving data without side effects. POST encapsulates data in the request body, more secure and without size limits.
What is the main purpose of adding custom headers to a URLRequest?
How to build a complex URL with multiple query parameters using URLComponents?
+17 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ iOS อื่นๆ
Swift Basics
Swift Language Essentials
UIKit Fundamentals
UIViewController Lifecycle
UserDefaults & Keychain
Application Lifecycle
Auto Layout & Constraints
UITableView & UICollectionView
SwiftUI Basics
SwiftUI State Management
SwiftUI Navigation
Codable & JSON Parsing
Core Data
Protocol Oriented Programming
MVVM Architecture
Push Notifications
Unit Testing & XCTest
UI Testing
Xcode & Build System
Swift Package Manager
Memory Management & ARC
Combine Framework
Concurrency & async/await
iOS Design Patterns
Performance Optimization
Security & Encryption
SwiftUI Advanced
iOS Application Architecture
เชี่ยวชาญ iOS สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี