I know this question must have been asked before in another form. I am trying to write to an NSOutputStream
a message I am composing from different things from my view.
@IBAction func sendMessage(sender: UIButton!) {
var msg = self.messageText.text as String!
var response = "msgtouser:" + self.nameofSender + ":" + nameofReceiver + ":" + self.messageText.text
var res : Int
self.outputStream.write(response, maxLength :response.lengthOfBytesUsingEncoding(NSASCIIStringEncoding))
}
I get an error when I try to make the reponse by concatenating multiple strings. The error I am getting is saying that String is not convertible to UInt8
when I try to concatenate the self.messageText.text
.
The same thing happens when I try to add the response variable