Is there any way I could pass an object method instead of a function to a function wanting a SCNetworkReachabilityCallBack as its argument?
Here is how SCNetworkReachabilityCallBack is defined:
typedef void (*SCNetworkReachabilityCallBack) (
SCNetworkReachabilityRef target,
SCNetworkReachabilityFlags flags,
void *info
);
Pass a block that sends the message, then have your C callback execute the block! 😀
Basically, the C callback is going to act as glue code. Since an Objective-C method’s IMP will never be of a type compatible with the callback, you are always going to need at least one level of indirection before you get to an Objective-C message dispatch. If you need to carry more state than just the object, a block may help you, but that C function stub isn’t going anywhere.