Get industry leading crash reporting for your iOS apps with Raygun4iOS 2.0
Posted May 8, 2015 | 3 min. (597 words)Today we’re pleased to announce the release of Raygun4iOS version 2.0. The main change in this release is that Raygun4iOS is now built using the static library project template introduced in Xcode 6. Previously (before static frameworks were available in Xcode) we had been using the “iOS Universal Framework” which I’m sure most of you who have built an iOS static framework would know about. As that project has now been retired due to built-in Xcode support, we’ve rebuilt Raygun4iOS on the standard static framework project template. We like to make sure that the software we provide to you is always built on the most stable and up-to-date foundations.
Additionally, error reports will now include the device model number (e.g. iPad2,5), and some minor improvements have been made to the custom data feature.
Gain valuable awareness of exceptions occurring in your published iOS applications by integrating Raygun4iOS 2.0 today. Here’s how:
Step 1
The recommended way to install Raygun4iOS is to use CocoaPods – an iOS dependency manager. You can learn more about this here. If you don’t want to use CocoaPods, you can download the Raygun4iOS framework here, reference it in your project and continue with step 2.
Add Raygun4iOS to your project’s Podfile:
platform :ios
pod 'Raygun4iOS'
Next, open a terminal, navigate to the directory containing your project’s Podfile and run:
pod install
Then open your project’s xcworkspace.
Step 2
In AppDelegate.m, import Raygun4iOS
#import <Raygun4iOS/Raygun.h>
Then simply initialize the error reporter with the code below. This can be placed in the “application” function of AppDelegate. Your api key is given to you when you create a new application at Raygun.io, and can also be viewed in your Raygun application settings.
[Raygun sharedReporterWithApiKey:@"YOUR_APP_API_KEY"];
Step 3
If your project fails to build at this point, simply click your project in Xcode, and then select your main project target. Next, go to the “Build settings” tab and search for “Other linker flags”. Add “-lc++” to the other linker flags setting and you’re good to go.
Step 4
At this stage your application is primed and ready to fire off errors to your Raygun account when something goes wrong. Go ahead and test this out by causing your app to crash. Note that when a crash occurs, the memory of the device is in an unpredictable state and so unsafe to send error reports immediately. Instead, Raygun4iOS safely saves the report to the device, and then sends it the next time the app starts up. Also, make sure the Xcode debugger is not attached to the app when you’re testing a crash as it will stop the program execution, preventing Raygun from detecting the crash.
Upload your dSYM files
When using Xcode to archive your app, a dSYM file is also generated which contains the symbols that can be used to generate readable stack traces. These dSYM files can be uploaded to Raygun which will cause your error reports to be symbolicated to produce a readable stack trace. Error reports need to be symbolicated using the correct dSYM file that was generated by the same app build that crashed. To make uploading your dSYM files easy, we provide a Mac application called Raygun Sidekick. This sits in your Mac menu bar and will detect, zip and upload the correct dSYM files for you. You’ll find the documentation here, and download the Raygun Sidekick here.
We’d love to hear from you
If you have any questions, suggestions or feedback about Raygun4iOS, we’d love to hear from you in the forums.