Closed D3vMohab closed 2 months ago
Thank you for reporting this issue. Unfortunately, the provided information is insufficient for us to diagnose and resolve the problem. Could you please provide the following details:
Once you have this information, please reopen the issue. Thank you!
I am using the latest version of KSCrash (ADDED IT VIA SWIFT PACKAGES) I am using it on an iPhone 14 Pro iOS 17.2 Simulator I got the code from the readme
#import <KSCrash/KSCrash.h>
// Include to use the standard reporter.
#import <KSCrash/KSCrashInstallationStandard.h>
// Include to use Quincy or Hockey.
#import <KSCrash/KSCrashInstallationQuincyHockey.h>
// Include to use the email reporter.
#import <KSCrash/KSCrashInstallationEmail.h>
// Include to use Victory.
#import <KSCrash/KSCrashInstallationVictory.h>
- (BOOL)application:(UIApplication*) application didFinishLaunchingWithOptions:(NSDictionary*) launchOptions
{
KSCrashInstallationStandard* installation = [KSCrashInstallationStandard sharedInstance];
installation.url = [NSURL URLWithString:@"http://put.your.url.here"];
// OR:
KSCrashInstallationQuincy* installation = [KSCrashInstallationQuincy sharedInstance];
installation.url = [NSURL URLWithString:@"http://put.your.url.here"];
// OR:
KSCrashInstallationHockey* installation = [KSCrashInstallationHockey sharedInstance];
installation.appIdentifier = @"PUT_YOUR_HOCKEY_APP_ID_HERE";
// OR:
KSCrashInstallationEmail* installation = [KSCrashInstallationEmail sharedInstance];
installation.recipients = @[@"some@email.address"];
// Optional (Email): Send Apple-style reports instead of JSON
[installation setReportStyle:KSCrashEmailReportStyleApple useDefaultFilenameFormat:YES];
// Optional: Add an alert confirmation (recommended for email installation)
[installation addConditionalAlertWithTitle:@"Crash Detected"
message:@"The app crashed last time it was launched. Send a crash report?"
yesAnswer:@"Sure!"
noAnswer:@"No thanks"];
// OR:
KSCrashInstallationVictory* installation = [KSCrashInstallationVictory sharedInstance];
installation.url = [NSURL URLWithString:@"https://put.your.url.here/api/v1/crash/<application key>"];
[installation install];
…
}
I also made this bug to crash the app
NSArray *tmp = @[@"TMP"];
NSLog(@"%@",tmp[5]);
Which crashes the app but next time I open the app I dont find KSCrash trigggered!
Oh, I see. It's a simulator. I assume you are running it under the debugger. Try crashing the application without the debugger attached, and then run it with the debugger as usual.
Should I just try a real device?
As I mentioned earlier, an attached debugger makes all the difference. You can try the steps I described in the comment above in any environment.
@GLinnik21 I ran it on a real device and it still didnt work, it didnt get triggered but it gave me this error from KSCrash
The error:
Thread 1: "*** -[NSConstantArray objectAtIndexedSubscript:]: index 5 beyond bounds [0 .. 0]" on g_originalTerminateHandler();
from this file // KSCrashMonitor_CPPException.c
the code used
#import <KSCrash.h>
// Include to use the standard reporter.
#import <KSCrashInstallationStandard.h>
// Include to use Quincy or Hockey.
#import <KSCrashInstallationQuincyHockey.h>
// Include to use the email reporter.
#import <KSCrashInstallationEmail.h>
// Include to use Victory.
#import <KSCrashInstallationVictory.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
KSCrashInstallationEmail* installation = [KSCrashInstallationEmail sharedInstance];
installation.recipients = @[@"support@sierra.app"];
// Optional (Email): Send Apple-style reports instead of JSON
[installation setReportStyle:KSCrashEmailReportStyleApple useDefaultFilenameFormat:YES];
// Optional: Add an alert confirmation (recommended for email installation)
[installation addConditionalAlertWithTitle:@"Crash Detected"
message:@"The app crashed last time it was launched. Send a crash report?"
yesAnswer:@"Sure!"
noAnswer:@"No thanks"];
[installation install];
double delayInSeconds = 12.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
NSArray *tmp = @[@"de"];
NSLog(@"%@",tmp[5]);
});
}
Lemme know what I am doing wrong for the pop up not to appear!
but it gave me this error from KSCrash
What do you mean? If this is related to a crash, please provide the full stack trace. Also, was the debugger attached when you encountered this error?
The debugger has to be attached when encountering this error because guess what without the debugger, KSCrash doesnt also trigger when a crash happens on a real device not a simulator!
@D3vMohab you're likely missing the call of "send all reports" on installation
:
Without it installations don't sent crash reports automatically and it's up to a developer to choose when is the best moment to ask a user to send a report.
Also, just to clarify, KSCrash doesn't catch crashes when Xcode is attached as a debugger. To test your setup you can launch the app without Xcode first, make a crash and then the next launch can be with a debugger attached.
Everytime the app crashes due to a bug, KSCrash returns null instead of the crash! How can I fix this?