I want to use CFStreamCreatePairWithSocketToHost with NSInput- and OutputStreams. I have two ivars NSInputStream *_inputStream and NSOutputStream *_outputStream.
The following gives me two error messages:
CFStreamCreatePairWithSocketToHost(NULL,
(__bridge_retained CFStringRef)self.hostname, self.port,
(CFReadStreamRef *)&_inputStream, (CFWriteStreamRef *)&_outputStream);
error: cast of an indirect pointer to an Objective-C pointer to '
CFReadStreamRef *' (aka 'struct __CFReadStream **') is disallowed with ARC
error: cast of an indirect pointer to an Objective-C pointer to 'CFWriteStreamRef *' (aka 'struct __CFWriteStream **') is disallowed with ARC
How would I fix this? I tried using __bridge but I got similar error messages.
Pass a pointer to actual
CFReadStreamRefandCFWriteStreamRefvariables, then cast when assigning to your NSTypes. Basically:Of course, you'll have to add the appropriate bridge cast and do all appropriate reference count ops for
cfThing.