Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Airbrake for your Swift application #1

Open
aramark-pivotal opened this issue Jun 1, 2017 · 0 comments
Open

Setup Airbrake for your Swift application #1

aramark-pivotal opened this issue Jun 1, 2017 · 0 comments
Labels

Comments

@aramark-pivotal
Copy link
Owner

Installation

Using cocoapods

pod 'Airbrake-iOS', '~> 4.1.2'

Directly from source code

  1. Download the notifier or clone from GitHub
  2. Drag the Airbrake folder to your project and make sure "Copy Items" and "Create Groups" are selected
  3. Add SystemConfiguration.framework to your project
  4. Add CrashReporter.framework to your project

Running the notifier in Swift as framework

  1. Add Airbrake-iOS to the podfile:

    use_frameworks!
    pod 'Airbrake-iOS'
    
  2. import Airbrake_iOS in app delegate (if you run into issue with build, please refer to issue #58)

  3. Set up the ABNotifer in your app delegate at the beginning of your 'func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {' (You can find your project ID and API KEY with your project's settings):

    ABNotifier.startNotifierWithAPIKey(
      "<Your project API KEY>",
      projectID: <Your project ID>,
      environmentName: ABNotifierAutomaticEnvironment,
      useSSL: true
    );

And you're good to go.

Running the notifier in Swift as static library

When you add Airbrake iOS to your Swift project, Xcode will automatically add the bridging header for 'ABNotifier' class.

When Xcode didn't generate the bridging header for your project, for example, you installed Airbrake iOS from cocoapods, you can create a bridge file manually.

  1. Add a new file to the project and choose Header File as template

  2. Next, Save as [ProjectName]_Bridging_Header.h and make sure it's at the root
    of the project.

  3. Open [ProjectName]-Bridging-Header.h and add ABNotifier, for example:

    #ifndef [ProjectName]_Bridging_Header
    #define [ProjectName]_Bridging_Header
    #import "ABNotifier.h"
    #endif
  4. Add [ProjectName]_Bridging_Header.h to your project build settings. In your
    project build settings, find Swift Compiler – Code Generation, and next to
    Objective-C Bridging Header add your bridging header file. Now you should be
    able to access ABNotifier class in your swift project

First, set up the ABNotifer in your app delegate at the beginning of your 'func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {' (You can find your project ID and API KEY with your project's settings):

ABNotifier.startNotifierWithAPIKey(
  "<Your project API KEY>",
  projectID: <Your project ID>,
  environmentName: ABNotifierAutomaticEnvironment,
  useSSL: true
);

For more information please visit our official GitHub repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant