I set the context to the address of the class that created the socket like this:
CFSocketContext ctxt = {0, (__bridge void *)(self), NULL, NULL, NULL};
self.sock = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_STREAM, IPPROTO_TCP, kCFSocketDataCallBack|kCFSocketConnectCallBack, *(CFSocketCallBack)takeCallback, &ctxt);
Then in the callback I put this:
static void takeCallback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void *data, void *info)
{
PUFTransCont* obj = (__bridge PUFTransCont *)(info);
}
I saw Apple sample code that does this and saw samples all over the internet doing this. Why is it not working when I did it. Whenever the execution hits
PUFTransCont* obj = (__bridge PUFTransCont *)(info);
I get a EXC_BAD_ACCESS