Reputation: 385
I am trying to add a REST API handling function to my existing iOS App. What I am trying to achieve is to make my iOS app work as local server network. I just started to learn about Vapor.
Face a problem when I want to start the server. It throws error
Unknown command -NSDocumentRevisionsDebugMode
Here is my class
import Vapor
import Leaf
class BackendManager {
var app = Application(.development)
init() {
app.http.server.configuration.hostname = "0.0.0.0"
app.http.server.configuration.port = 8080
app.views.use(.leaf)
app.leaf.cache.isEnabled = app.environment.isRelease
app.leaf.configuration.rootDirectory = Bundle.main.bundlePath
app.routes.defaultMaxBodySize = "50MB"
}
func start() {
Task(priority: .background) {
do {
try app.start()
} catch {
fatalError(String(describing: error))
}
}
}
}
And here is how I call it
let server = BackendManager()
server.start()
Here is my configuration
What am I missing here? Thanks ...
Upvotes: 3
Views: 681
Reputation: 385
After followed the solution suggested in (Xcode and Python) error: unrecognized arguments: -NSDocumentRevisionsDebugMode
It will throw another error -AppleLanguages
Someone in the Discord group helped me to solve this by passing this configuration before start the server
app.environment.arguments = [app.environment.arguments[0]]
and it is done
Hope this will help anyone affected in the future
Upvotes: 3