
iOS \ Swift
[Swift] The data couldn’t be read because it is missing 에러 해결하기
에러 상황 Http 통신을 통해 서버에서 데이터를 받아오는 중에 발생한 에러입니다. 수신한 Json 형식의 데이터를 decode하는 과정에서 문제가 발생했습니다. 즉, do 문에서 오류가 발생해서 catch 문으로 넘어가는 상황입니다. import Foundation func getNews(completion: @escaping (News) -> Void) { print("hello") guard let url = URL(string: "https://api.lil.software/news") else { fatalError("URL could not be constructed") } URLSession.shared.dataTask(with: url) { (data, response, error) in ..