I am trying to port my application to iOS5. I am using a TCP connection to the server through CFSockets. Now my problem is casting from CFReadStreamRef to NSInputStream (same with write). With iOS4, I could use a free bridge, but with iOS5 automatic link counting this is no longer possible. This is what I get:
error: Automatic Reference Counting Issue: Cast to 'NSInputStream *' of a non-Objective-C to an Objective-C pointer is disallowed with Automatic Reference Counting
the code:
CFReadStreamRef readStream; CFWriteStreamRef writeStream; CFStringRef strRef = CFStringCreateWithCString(NULL, [urlStr UTF8String], NSUTF8StringEncoding); CFStreamCreatePairWithSocketToHost(NULL, strRef, 4444, &readStream, &writeStream); NSInputStream *iStream = (NSInputStream *)readStream; NSOutputStream *oStream = (NSOutputStream *)writeStream;
Is there any other way to connect socket output / input in NSStream? Thanks for any hint!
ios5 network-programming release counting
Olli
source share