macOS, iOS
[iOS] Alamofire - 'there is no such file' 문제
SweetDev
2020. 7. 19. 13:49
Alamofire을 이용해서 이미지를 서버에 업로드 하는데, 다음과 같은 경고가 뜨면서 이미지 업로드가 안되는 문제가 발생했다.

"no such file"....!!!!
분명히 사진 url을 받아와서 그대로 넘겨줬는데 왜 안될까???
스택오버플로우를 찾아보니 다음과 같은 이야기가 있었다.
Container locations change periodically therefore never save full paths pointing to the application container to UserDefaults. Save only the file names and get the URL to the current document directory always with
let documentsFolderURL = try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
Then append the file name with .appendingPathComponent
=> Container locations change periodically, 즉 불러올때마다 이미지 location이 바뀐다는 것 !!!!