Under ARC a parameter declared as:
SomeObjectType ** parameterName
has the implicit ownership qualifier of __autoreleasing
:
SomeObjectType * __autoreleasing * parameterName
Such parameters are out parameters, that is they receive a value from the called method rather than pass a value to the called method, and the actual parameter must be the address of a local variable. This mechanism is referred to as pass-by-writeback.
The error message is telling you that one or both of addresses you have passed are not those of local variables, i.e. either or both of inputStream
or outputStream
are not local variables.
The simple fix is to introduce local variables to use for the parameters and after the call copy the returned values into your non-local variables:
NSInputStream *tempInputStream;
NSOutputStream *tempOutputStream;
[NSStream getStreamsToHostNamed:relayHost port:relayPort inputStream:&tempInputStream outputStream:&tempOutputStream];
// copy return values to non-local variables
inputStream = tempInputStream;
outputStream = tempOutputStream;
If you wish to understand the reasons why out parameters only accept local variables read Passing to an out parameter by writeback in Apple's Clang documentation.
HTH