Assigning PLCrashReporterCallbacks to crash reporter in swift

478 Views Asked by At

So I'm trying to assign the callback function in swift when the app crashes. Here is, more or less, how it's done in Obj-C code.

/* postCrash callback */
void myCallback (siginfo_t *info, ucontext_t *uap, void *context) {
    //something to do here.
}

....
....

/* Set up post-crash callbacks */
PLCrashReporterCallbacks cb = {
    .version = 0,
    .context = nil,
    .handleSignal = myCallback
};

[crashReporter setCrashCallbacks: &cb];

Does anybody know how the myCallback should be implemented and assigned?

0

There are 0 best solutions below