当 TestFlight 崩溃时,我有一个日志,我希望上传它的崩溃报告。
按照他们网站上的说明,我想出了这个解决方案,但它似乎没有将我传递给 TFLog 的日志发送。但是它报告崩溃就好了。
-(void)applicationDidFinishLaunching:(UIApplication *)application {
/*Setup crash handlers for TestFlight so we can send logs. */
NSSetUncaughtExceptionHandler(&testFlightHandleExceptions);
// create the signal action structure
struct sigaction newSignalAction;
// initialize the signal action structure
memset(&newSignalAction, 0, sizeof(newSignalAction));
// set SignalHandler as the handler in the signal action structure
newSignalAction.sa_handler = &testFlightSignalHandler;
// set SignalHandler as the handlers for SIGABRT, SIGILL and SIGBUS
sigaction(SIGABRT, &newSignalAction, NULL);
sigaction(SIGILL, &newSignalAction, NULL);
sigaction(SIGBUS, &newSignalAction, NULL);
[TestFlight takeOff:TESTFLIGHT_API_KEY];
}
void testFlightHandleExceptions(NSException *exception) {
[LogManager e: @"Sending crash to TestFlight" Tag:@"AppDelegate"];
TFLog(@"%@",[LogManager getLog]);
}
我哪里出错了?或者有没有更好的方法来做到这一点?