Closed makorendev closed 3 years ago
The reason write permissions were not allowed is because I was serving files directly from the app bundle, which cannot be written to.
My solution was to copy the contents of that directory into the Documents directory and use WebDAV to write to that directory instead.
I'm currently trying to use GCDWebServer to host a local webpage that's requested by a WKWebView when the app starts. I want to be able to upload external files to the server by grabbing files with a UIDocumentPickerViewController while the app is running. It seems like using a separate GCDWebDAVServer on a different port is a good idea for this.
However, if I try to upload a file to the WebDAV server, I get this data from the response:
Cutting out this bit for readability:
www
in this context is the local folder I'm serving with GCDWebServer. It has no subfolders, only files.Here's the code I'm using in
viewDidLoad
:And the code used for a PUT request to upload a file to the WebDAV server:
This doesn't have anything to do with iOS 14 local network privacy features. I tried modifying the Info.plist to include the new keys, but nothing changed. It seems like the
www
folder doesn't have write permissions.Is there a feature I'm missing that lets you change file permissions in GCDWebServer, or is there a workaround? Right now the only workaround I can think of is to create a local database alongside the web servers.