KSCrash
KSCrash copied to clipboard
macOS application getting "Cannot send mail on this platform" error.
Below code we used.
func installCrash() {
// add crash report
let installation = self.crashReportEmail()
installation.install()
KSCrash.sharedInstance()?.deleteBehaviorAfterSendAll = KSCDeleteNever
installation.sendAllReports { (reports, completed, error) in
if completed {
print("Sent reports: \(String(describing: reports))")
} else {
print("Failed to send report: \(String(describing: error?.localizedDescription))")
}
}
}
func crashReportEmail() -> KSCrashInstallation {
// email instance creation.
let email = KSCrashInstallationEmail.sharedInstance()
email?.recipients = ["[email protected]"]
email?.subject = "Crash Report"
email?.message = "This is a crash report"
email?.filenameFmt = "crash-report-%d.txt.gz";
email?.addConditionalAlert(withTitle: "Crash Dectected",
message: "The app crashed last time it was launched. Send a crash report?",
yesAnswer: "Sure!",
noAnswer: "No thanks")
email?.setReportStyle(KSCrashEmailReportStyleApple, useDefaultFilenameFormat: true)
return email!
}
ERROR: KSCrash.m (341): -[KSCrash sendAllReportsWithCompletion:]_block_invoke: Failed to send reports: Error Domain=KSCrashReportSinkEMail Code=0 "Cannot send mail on this platform" UserInfo={NSLocalizedDescription=Cannot send mail on this platform} Failed to send report: Optional("Cannot send mail on this platform")
In addition, on iOS mailto://
is not supported. That is needed if the user has not configured Mail and is using another default mail app such as Outlook.
same problem