error "Passing address of non-local object to __autoreleasing parameter for write-back"

Viewed 20856

I'm converting my socket client to ARC:

- (id)initWithHostname:(NSString *)hostname AndPort:(NSInteger)port
{
    if((self = [super init]))
    {
        oBuffer = [[NSMutableData alloc] init];
        iBuffer = [[NSMutableData alloc] init];

        iStream = [[NSInputStream alloc] init];
        oStream = [[NSOutputStream alloc] init];

        [NSStream getStreamsToHost:[NSHost hostWithName:hostname] port:port inputStream:&iStream outputStream:&oStream];

        ...
    }

    return self;
}

The error I got is:

error: Automatic Reference Counting Issue: Passing address of non-local object to __autoreleasing parameter for write-back

at this line on &iStream and &oStream:

[NSStream getStreamsToHost:[NSHost hostWithName:hostname] port:port inputStream:&iStream outputStream:&oStream];

Any help?

3 Answers
Related