Copyright 2004 by M. Uli Kusterer Fri, 29 Nov -1901 11:06:32 GMT Comments on article blog-ukcrashreporter-oh-three at Zathras.de http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm blog-ukcrashreporter-oh-three Comments witness_dot_of_dot_teachtext_at_gmx_dot_net (M. Uli Kusterer) witness_dot_of_dot_teachtext_at_gmx_dot_net (M. Uli Kusterer) en-us Comment 9 by Kevin Boyce http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment9 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment9 Hi Uli,

I am adding UKCrashReporter to my app, and in some cases there are crash logs sitting around from earlier versions. Of course these logs trigger UKCrashReporter, which would probably confuse the user, since it didn't crash the previous time he used my app, it just got upgraded to the new version with UKCR.

To solve this problem, I added a couple lines to check whether UKCR has ever run, and if not pretend it did. I replaced

if( lastTimeCrashLogged )

with the following:

// Enter a time, but don't send a crash report, if this was the first time we've run with UKCrashReporter installed.
if( !lastCrashReportInterval )
{
[[NSUserDefaults standardUserDefaults] setDouble: [[NSDate date] timeIntervalSince1970] forKey: @"UKCrashReporterLastCrashReportDate"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
else if( lastTimeCrashLogged )

Is there any reason you can think of why this would cause any trouble?

Thanks for all your work!
-Kevin
Comment 8 by Uli Kusterer http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment8 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment8 Uli Kusterer writes:
Yes, you need to use the included NIB, because UKCrashReporter tries to load that, you can't just copy the window elsewhere and expect UKCR to find it.
Comment 7 by Decoder http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment7 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment7 Thanx... it is now getting properly compiled :).

However after running it I am getting following message printed at debugger console: UKCrashReporter: Couldn't find NIB file "UKCrashReporter.nib".

Also no crash reporter is invoked on its crash :(

Should I create a new XIB for UKCrashReporter and integrate it in my project in place of step 2 and 3, (written in previous comment) to make it working?
Comment 6 by Uli Kusterer http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment6 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment6 Uli Kusterer writes:
Decoder, you're missing Apple's address book framework. You have to link to that to get these symbols. The crash reporter uses the address book to find a return e-mail address for the user.
Comment 5 by Decoder http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment5 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment5 Hi Uli,

I tried to integrate UKCrashReporter in a sample application over snow leopard but it is giving following errors:

1. "_kABEmailProperty", referenced from:
_kABEmailProperty$non_lazy_ptr in UKCrashReporter.o
(maybe you meant: _kABEmailProperty$non_lazy_ptr)

2. ".objc_class_name_ABAddressBook", referenced from:
literal-pointer@__OBJC@__cls_refs@ABAddressBook in UKCrashReporter.o
ld: symbol(s) not found

I followed steps as written below:

1. Included following files within my project:
UKCrashReporter.h/.m, UKCrashReporter.strings, UKNibOwner.h/.m, UKSystemInfo.h/.m.

2. Copied the window from UKCrashReporter.nib to MyProject.XIB.

3. Dropped an object cube within XIB. Set its class as UKCrashReporter.

4. Performed all bindings between window (step 2) and UKCrashReporter object (step 3).

5. In UKCrashReporter.strings file set "CRASH_REPORT_CGI_URL" as: "http://xyz.com/crashreportform.php"

6. In controller class included "UKCrashReporter.h" file and called UKCrashReporterCheckForCrash(); method within applicationDidFinishLaunching:

7. Then I compiled it with build settings: 10.5 / 10.6 but it gave errors listed above in both cases.

Can you please suggest if I am doing anything wrong ?

Thanks!
Comment 4 by Matthieu Cormier http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment4 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment4 Matthieu Cormier writes:
For future readers, you may need to call utf8_decode as PHP doesn't play super nice with unicode.

$crashlog = $_REQUEST['crashlog'];
$decodedLog = utf8_decode($crashlog);
Comment 3 by Tony Arnold http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment3 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment3 Tony Arnold writes:
Perfect - thanks mate :)
Comment 2 by Uli Kusterer http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment2 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment2 Uli Kusterer writes:
No time, but the basic principle (in PHP) would be

<?php
$crashlog = $_REQUEST['crashlog'];

mail( "email@example.com", "Crash Report", "\r\n\r\n".$crashlog);
?>
Comment 1 by Tony Arnold http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment1 http://www.zathras.de/angelweb/blog-ukcrashreporter-oh-three.htm#comment1 Tony Arnold writes:
Hi Uli, have you got an example of the PHP script you use to collect the info output by your crash reporter you wouldn't mind sharing?