Hello, I am somewhat new to iPhone dev and I have been getting unrecognized selector when I call CFSocketConnectToAddress in this code. I think it might be something basic that I am doing wrong. Any idea?
this is the complete error I get.
NSInvalidArgumentException unrecognized selector sent to instance 0x3922170
0x3922170 is the calling class.
- (BOOL)connect
{ CFSocketRef mySocket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM,IPPROTO_UDP, 0, socketCallback, NULL);
@try {
CFDataRef data = (CFDataRef)[_netService addresses];
CFSocketConnectToAddress(mySocket, data, 500);
}
@catch (NSException * e) {
NSLog([e name]);
NSLog([e reason]);
}
//char joke[] = "Why did the chicken cross the road?";
//CFSocketError err = CFSocketSendData(mySocket, joke, (strlen(joke)+1), 10);
return true;
}
void socketCallback ( CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void *data, void *info) {
}