1
@IBAction func Send_Pressed(_ sender: Any)
{
    // Send this data in the TEXT BOX to the stream
    iData    = textFIELD_textsend.text!
    sendData = iData.data(using: String.Encoding.utf8)
    uData    = sendData?.withUnsafeBytes({ (buffer:UnsafePointer<UInt8>?) -> UnsafePointer<UInt8> in return buffer!.advanced(by: 0)})
    
    // Send the data to the OUTPUT STREAM
    outputStream.write(uData!, maxLength: sendData!.count)
    NSLog("Constructed string = \(iData)")
}

The system say "uData = sendData?.withUnsafeBytes({ (buffer:UnsafePointer?) -> UnsafePointer in return buffer!.advanced(by: 0)})" is deprecated and when i send the data to my TCP server is null,how to fix it?

DeepSpace
  • 78,697
  • 11
  • 109
  • 154
wong anson
  • 11
  • 1

0 Answers0