Skip to content

Instantly share code, notes, and snippets.

@dennda
Created September 6, 2011 17:18
Show Gist options
  • Save dennda/1198272 to your computer and use it in GitHub Desktop.
Save dennda/1198272 to your computer and use it in GitHub Desktop.
- (void) setupSockets {
void* info = (__bridge void*) self;
readsock = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM,
IPPROTO_UDP, kCFSocketReadCallBack |
kCFSocketAcceptCallBack | kCFSocketDataCallBack |
kCFSocketConnectCallBack | kCFSocketWriteCallBack,
(CFSocketCallBack)readSockCallBack, info);
....
}
void readSockCallBack(CFSocketRef sock, CFSocketCallBackType type, CFDataRef addr,
const void* d, void* info) {
switch (type) {
case kCFSocketDataCallBack: {
CFDataRef data = (CFDataRef) d;
NetDrawPoint p;
memcpy(&p, CFDataGetBytePtr(data), sizeof(p));
CanvasView* self = (__bridge CanvasView*) info;
[self addPoint:p]; // <----- This causes the crash
}
}
}
// Here's the error:
2011-09-06 10:18:19.007 NetDraw[53224:f203] -[CALayer addPoint:]: unrecognized selector sent to instance 0x7678890
2011-09-06 10:18:19.061 NetDraw[53224:f203] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CALayer addPoint:]: unrecognized selector sent to instance 0x7678890'
*** First throw call stack:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment