How to cast blocks to and from void *
问题 So, I'm trying to pass a block as an NSAlert contextInfo parameter. [myAlert beginSheetModalForWindow: theWindow modalDelegate: myAlert didEndSelector: @selector(alertDidEnd:returnCode:contextInfo:) contextInfo: (void *) aBlock]; and get it back on the other end: void (^responseBlock)() = (__bridge_transfer void (^)()) contextInfo; Which works, to an extent. Before my call to beginSheetModalForWindow:... aBlock is at 0x00007fff610e1ec0 , and in the response ( alertDidEnd:... ), contextInfo is