I was trying to figure out how to monitor keychain events, and wrote:
dispatch_async(dispatch_get_main_queue(), ^{
OSStatus kr = SecKeychainAddCallback(MyKeychainEventCallback, kSecEveryEventMask, NULL);
printf("Got result %d\n", kr);
});
dispatch_main();
However, the callback never gets called.
I put the same code into a simple GUI app (invoked from the didFinishLaunching method), and it does work. So presumably this is something run-loop related. But I can't seem to figure it out -- so what am I doing wrong?