Installation

Raygun provides crash reporting and error monitoring for iOStvOS & macOS. This provider is written in Objective-C and can be used with both Objective-C and Swift applications.

The provider supports:

  • iOS 10+
  • tvOS 10+
  • macOS 10.10+

To integrate Raygun using CocoaPods, update your Podfile to include:

pod 'raygun4apple'

Once updated you can run pod install from Terminal.

The latest release can be found here. The frameworks are attached to each release as a zipped file. This can be downloaded, unzipped and included in you project directory.

Once included, go to your app's target General settings and add the raygun4apple framework to the Frameworks, Libraries, and Embedded Content section. Ensure that the framework is set to Embed & Sign.

Embedding Raygun4apple in your Xcode project

note: The Raygun4Apple provider is developed as a “fat” library, which includes architectures for both simulators and devices. You will need to strip out the simulator architectures (x86_64, i386) before releasing. There is a helpful article on how to do this here.


In your AppDelegate class file, import the header for your target platform.

note: For Swift projects you must create an Objective-C bridging header to be able to import the header for your target platform. You can find out how to do this by visiting Apple's documentation for more details.

For iOS:

#import <raygun4apple/raygun4apple_iOS.h>

For tvOS:

#import <raygun4apple/raygun4apple_tvOS.h>

For macOS:

#import <raygun4apple/raygun4apple_macOS.h>

Initialize the Raygun client by adding the following snippet to your application:didFinishLaunchingWithOptions method:

Objective-C:

RaygunClient *raygunClient = [RaygunClient sharedInstanceWithApiKey:@"YOUR_APP_API_KEY"];
[raygunClient enableRealUserMonitoring];
[raygunClient enableNetworkPerformanceMonitoring]; // Optional

Swift:

let raygunClient = RaygunClient.sharedInstance(apiKey: "YOUR_APP_API_KEY")
raygunClient.enableRealUserMonitoring()

Your app API key is displayed when you create a new application in your Raygun account, or can be viewed in the application settings.


By default, each user will be identified with a unique guid and marked as anonymous. The identifier property on the RaygunUserInformation class is what separates one user from another. Be sure to set it with something unique, for example a database id, username or email address. If the user changes, for instance when logging in or out, be sure to update the user information on the shared Raygun client each time. You can assign user information as described below.

Objective-C:

RaygunUserInformation *userInfo = [[RaygunUserInformation alloc] initWithIdentifier:@"user@raygun.com"
                                                                         withEmail:@"user@raygun.com"
                                                                      withFullName:@"Test User"
                                                                     withFirstName:@"Test"];
RaygunClient.sharedInstance.userInformation = userInfo;

Swift:

let userInformation = RaygunUserInformation(identifier: "user@raygun.com", email: "user@raygun.com", fullName: "Test User", firstName: "Test")
RaygunClient.sharedInstance().userInformation = userInformation