Page 1 of 1

Crash Reporter

PostPosted: Sat May 19, 2012 4:48 pm
by udo.killermann

sometimes it can get really annoying that the Crash Reporter (see below) shows up after your application just failed you and exit with an exception. The Crash Reporter looks like this:
reporterInAction.jpg (20.38 KiB) Viewed 1049 times

I just press [ignore] every time, but I don't want to be alerted in the first place.

Here is a class (UKCrashReporter.NSObject) I constructed as a helper to disable Crash Reporter in some situations:
Code: Select all
Dim bCrashReporter As Boolean

Function crashReporter() As Boolean
  Return bCrashReporter 
End Function

Sub setCrashReporter(state As Boolean)
  bCrashReporter = state
  If (bCrashReporter) Then
    Log(Bash("/usr/bin/defaults write DialogType developer"))
    Log(Bash("/usr/bin/defaults write DialogType server"))
  End If
End Sub

Crash Reporter is controlled via user defaults and I could have used NSUserDefaults but the command line just comes in handy.

The methods are thought to work at the class level and should be used this way:
Code: Select all
' Global Object:
' this method isn't there at all - just demo
Declare Function "NSString" + (void)helloWorld

Dim myArrRead As Array
Dim myArrWrite As Array

Event AwakeFromNib()
  Dim myReporter As UKCrashReporter
  ' do something wrong
End Event

Give it a try and comment back to me.