I'm making this wallpaper app that lets users download the wallpaper to their local system. The problem I am having: when creating a request to download a specific wallpaper, the request states "An unknown error occurred, please check the server response." Here is the error code in more depth when printing the entire error to the console:
Error Domain=FIRStorageErrorDomain Code=-13000 "An unknown error occurred, please check the server response." UserInfo={object=wallpapers/37.jpg, bucket=flowr---flower-wallpapers.appspot.com, NSLocalizedDescription=An unknown error occurred, please check the server response., ResponseErrorDomain=NSCocoaErrorDomain, NSFilePath=/local/images, NSUnderlyingError=0x600003fcd380 {Error Domain=NSPOSIXErrorDomain Code=30 "Read-only file system"}, ResponseErrorCode=642}
One thing I noticed is that the error states that there is a "Read-only file system." On iOS do I need to get permission from the user, or do I need to place the downloaded image in an accessible directory on the user's system?
Here is the original code for the database request:
let wallpaperRef = Globals.storageRef.storage.reference(withPath: Globals.FireStoreDirectories.wallsDirectory + passedImageName)
let localURL = URL(string: "file:///local/images/" + passedImageName)!
// Download to the local filesystem
let downloadTask = wallpaperRef.write(toFile: localURL) { url, error in
if let error = error {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.75) {
showLoadingToast = false
}
print(error.localizedDescription)
print(error)
} else {
print("Download locale: " + url!.description)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.75) {
showLoadingToast = false
}
}
}
The wallpaper and the directories are all correct, however, the database request fails because of a read only file system.