NSInputStream
我正在尝试NSOutputStream
在NSNetService
. getInputStream 方法需要以下类型的参数UnsafeMutablePointer<NSInputStream?>
:
public func getInputStream(inputStream: UnsafeMutablePointer<NSInputStream?>, outputStream: UnsafeMutablePointer<NSOutputStream?>) -> Bool
但是当我这样做时 inputStream 和 outputStream 保持为零并且成功为假:
let inputStream:UnsafeMutablePointer<NSInputStream?> = nil
let outputStream:UnsafeMutablePointer<NSOutputStream?> = nil
var succes = service.getInputStream(inputStream, outputStream: outputStream)
另一个问题是我不能将它作为“NSInputStream”来处理,因为它是“UnsafeMutablePointer”类型的。当我尝试这个时,我收到以下错误:
Error:(52, 13) value of type 'UnsafeMutablePointer<NSInputStream?>' (aka 'UnsafeMutablePointer<Optional<NSInputStream>>') has no member 'delegate'
快速处理这些可变指针类型的正确方法是什么?任何帮助将不胜感激,谢谢!