         var type: String
         var name: String
         var port: Int
-        var txtRecord: [String: Data] = [:]
+        var txtRecord: [String: Data]?
         var callbackId: String
         var commandDelegate: CDVCommandDelegate?
         
-        init (withDomain domain: String, withType type: String, withName name: String, withPort port: Int, withTxtRecord txtRecord: [String: Data], withCallbackId callbackId: String) {
+        init (withDomain domain: String, withType type: String, withName name: String, withPort port: Int, withTxtRecord txtRecord: [String: Data]?, withCallbackId callbackId: String) {
             self.domain = domain
             self.type = type
             self.name = name

        }
        
        var txtRecord: [String: String] = [:]
        let dict = NetService.dictionary(fromTXTRecord: netService.txtRecordData()!)
        for (key, data) in dict {
            txtRecord[key] = String(data: data, encoding:String.Encoding.utf8)
        }
        
        var hostName:String = ""

            let service = NetService(domain: domain, type: type , name: name, port: Int32(port))
            nsp = service
            service.delegate = self
            
            if let record = txtRecord {
                if record.count > 0 {
                    service.setTXTRecord(NetService.data(fromTXTRecord: record))
                }
            }
            
            commandDelegate?.run(inBackground: {
                service.publish()
