becvert/cordova-plugin-websocket-server

iOS: "fatal error: unexpectedly found nil while unwrapping an Optional value" when starting server

elewin opened this issue · 4 comments

Hi, I've installed the latest version of this plugin (1.4.3), now when trying to call wsserver.start(), XCode (and the app) will immediately crash with the error:
"fatal error: unexpectedly found nil while unwrapping an Optional value" (lldb)

It does this even when using the configuration object in the readme

Im using:
Xcode 8.3.3
Cordova 6.3.1

Any ideas? Thanks

I don't know much about Swift/ObjC, but I think it might be:

if tcpNoDelay! { server.setTcpNoDelay(true) }
in WebSocketServer.swift
where tcpNoDelay is nil

Ok, looks like it is tcpNoDelay; I hadn't noticed the updated config settings with the latest update, and leaving that option out will crash the app when it tries to force unwrap the optional. Maybe add a default if none is specified as a fail-safe?

I'll fix that! thank you

fixed with 1.4.5