Reputation: 961
There are enough samples available for iOS but not for Mac.
Upvotes: 0
Views: 632
Reputation: 61228
I've never used PLCrashReporter, but a few seconds exploring the PLCrashReporter web site turned up a thread in which someone received a reply from an author about a problem using it with a Mac. While it looks as though it was designed with iOS in mind, "official" opinion seems to indicate it's not iOS specific and should work just fine on Mac OS.
In any case, I think you'd have more luck joining this thread, which was started just over a week ago as of the time of this post. Maybe if you add your own voice, the author(s) will provide a specific example.
In all likelihood, though, the example provided by their documentation should work almost exactly the same with the Mac UIApplication
analog, NSApplication
, with a little adaptation. I make this assumption because the author seems to think it'll work just fine on the Mac and that it's obvious how to make it work. I'd make this assumption if I were scouting PLCrashReporter for my own use so I did what I always do in that situation. I looked at the documentation and a bit at the code. A quick look convinced me that just substituting the UIApplicationDelegate
protocol method -applicationDidFinishLaunching:(UIApplication *)application
with the Mac NSApplicationDelegate
equivalent - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
should make it work in a Mac app.
The -applicationDidFinishLaunching:
method is probably already stubbed out in the default application delegate class the Mac app template Xcode provides to every new project. Just copy and paste the example method's body into the stub if it's already there. Make sure you follow the author's build phase advice in the first thread so relevant libraries and resources go along for the ride when you build your app.
I haven't tried this, but if did, I'd copy the -handleCrashReport
method verbatim into my app delegate, and copy the body of the ...DidFinishLaunching:
hook into the template's body (you may already have some code there; slap it in before or after yours, whichever makes sense if it makes any difference at all). I'd import the necessary headers into the app delegate since it probably won't find PLCrashReporter
or any of its related symbols otherwise. I'd also make sure the Framework/library/resources is properly linked and that it's copied into the app bundle, and then I'd hit Run and see what happens, solving problems as I go.
Try it. Let us know how it goes.
Upvotes: 1