[英]TestFlight TFLog not uploading when there is a crash
When TestFlight crashes I have a log I wish to upload with its crash report. 当TestFlight崩溃时,我有一个日志希望与崩溃报告一起上传。
Following the instructions on their website I came up with this solution, but it doesn't seem to be sending the log I pass to TFLog. 按照他们网站上的说明,我想出了这个解决方案,但似乎并没有将我传递的日志发送到TFLog。 However it reports the crash just fine.
但是,它报告崩溃完全正常。
-(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]);
}
Where have I gone wrong? 我哪里出问题了? Or is there a better way in doing this?
还是有更好的方法呢?
There are two problems I can see with this: 我可以看到两个问题:
testFlightHandleExceptions
is going to be called after the crash and it's logs are recorded. testFlightHandleExceptions
会崩溃之后被调用,它的日志记录。 Instead you need to be calling TFLog
inside of LogManager
every time you log something (before the crash). 相反,您每次在日志记录之前(崩溃之前)都需要在
LogManager
内部调用TFLog
。 That's how it's meant to be used. 这就是使用它的方式。
It is not ok to use objc
inside of a signal handler. 这是不正常使用
objc
信号处理程序内。 For that matter, most c
isn't even allowed. 因此,大多数
c
甚至都不被允许。
Hope that helps :) 希望有帮助:)
Jason 杰森
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.