0
    - (void)connection:(NSString*)serviceName forIpAddress:(NSString *)ipAddress
       forPort:(NSString *)portNo
  {
if(inputStream && outputStream)
    //[self close];

    NSString *urlString = [NSString stringWithFormat:@"http://%@",ipAddress];

NSURL *website = [NSURL URLWithString:urlString];

if (!website) {
    NSLog(@"%@ is not a valid URL", website);
}
CFReadStreamRef readStream;
CFWriteStreamRef writeStream;
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)[website host], [portNo
                                                                       intValue], &readStream, &writeStream);
CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket,
                        kCFBooleanTrue);
CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket,
                         kCFBooleanTrue);
inputStream = (NSInputStream *)readStream;
outputStream = (NSOutputStream *)writeStream;
[self open];

}

Getting ARC errors at NNString, NSInputStream,NSoutputStream. Error says..Cast of c pointer type CFreadStreamRef to c pointer type NSinput stream needs bridging cast.

user2864740
  • 60,010
  • 15
  • 145
  • 220
Avis
  • 505
  • 4
  • 14

1 Answers1

0
NSInputStream *inputStream = (__bridge_transfer NSInputStream *)readStream;
NSOutputStream *outputStream = (__bridge_transfer NSOutputStream *)writeStream;

See Setting Up Socket Streams programming guide.

toma
  • 1,471
  • 12
  • 20