Swiftpack.co - Package - bugsnag/bugsnag-cocoa
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Bugsnag exception reporter for iOS and macOS

iOS Documentation tvOS Documentation macOS Documentation Build status

The Bugsnag crash reporter for Cocoa library automatically detects crashes and fatal signals in your iOS 9.3+, macOS 10.11+ and tvOS 9.2+ applications, collecting diagnostic information and immediately notifying your development team, helping you to understand and resolve issues as fast as possible. Learn more about iOS crash reporting with Bugsnag.


  • Automatically report unhandled exceptions and crashes
  • Report handled exceptions
  • Log breadcrumbs which are attached to crash reports and add insight to users' actions
  • Attach user information and custom diagnostic data to determine how many people are affected by a crash

Getting started


  1. Create a Bugsnag account
  2. Complete the instructions in the integration guide for iOS
  3. Report handled exceptions using [Bugsnag notify:]
  4. Customize your integration using the configuration options


  1. Create a Bugsnag account
  2. Complete the instructions in the integration guide for macOS
  3. Report handled exceptions using [Bugsnag notify:]
  4. Customize your integration using the configuration options



All contributors are welcome! For information on how to build, test, and release bugsnag-cocoa, see our contributing guide.


The Bugsnag Cocoa library is free software released under the MIT License. See LICENSE.txt for details.


Stars: 164


v6.5.1 - 2021-01-13T13:58:52

Bug fixes

  • Fix a regression where OOM events were missing session information. #963
  • Make maxPersistedEvents and maxPersistedSessions comply with the specification, with defaults of 32 and 128 respectively. #966

v6.5.0 - 2021-01-06T14:13:45


  • Errors may now be discarded based on their errorClass using the new discardClasses configuration option. #938

  • The maxiumum number of persisted errors / events may now be configured using the new maxPersistedEvents configuration option. #936

  • The maxiumum number of persisted sessions may now be configured using the new maxPersistedSessions configuration option. #943

  • Bugsnag log messages are now prefixed with [Bugsnag] for easier searching & filtering. #955

Bug fixes

  • Fix reliability of Swift fatal error message reporting. #948

v6.4.1 - 2020-12-14T12:52:42

Bug fixes

  • Place "unhandledOverridden" inside "severityReason" instead of at the top level. #937

v6.4.0 - 2020-12-09T08:34:26


  • Allow overriding the "unhandled" flag in error callbacks. #921 #912

Bug fixes

  • Fix unexpected exception behavior when started without an API key. #931

v6.3.0 - 2020-12-02T14:28:14


  • Out Of Memory errors now include more information, including custom metadata and user information. #915 #908

  • Bugsnag can now be used without UIKit, reducing memory usage in app extensions. #919

Bug fixes

  • Fixed incorrect app version reported when sending crash reports from older versions of Bugsnag (before 6.2.3) #911

  • Fixed a rare crash in -[BugsnagClient computeDidCrashLastLaunch] #917

v6.2.6 - 2020-11-25T16:30:48

Bug fixes

  • Error and session deliveries that fail with an HTTP error status code will now be retried if appropriate. #895

  • Fixed a rare crash in BugsnagClient's network connectivity observer block. #904

v6.2.5 - 2020-11-18T13:30:12

Bug fixes

  • Fixed a rare crash due to a race condition in BugsnagSystemState. #893 #866

  • Out Of Memory errors are no longer reported if a device reboot was detected. #822 #545

v6.2.4 - 2020-11-04T13:45:29

Bug fixes

  • The onCrashHandler is no longer called in the event of an OOM. #874

v6.2.3 - 2020-10-29T08:05:22


  • Use os_proc_available_memory() to get free memory, if available. #851

  • Reduced the CPU and memory impact of leaving breadcrumbs. #853 #863

Bug fixes

  • Fix for incorrect version info during edge case where version info is not manually set, and app version is changed between crashing and reporting the error. #862

  • Catch and report unexpected exceptions when (de)serializing JSON data rather than crashing. #856

v6.2.2 - 2020-10-21T13:18:17


  • Support "foreground" duration in MacOS as well. 848

  • Timestamp accuracy in reports has been increased from seconds to milliseconds. 847

  • Calculation of "foreground" duration now also includes time in UIApplicationStateActive and UIApplicationStateInactive states in order to match Apple's definition of "foreground". 839

v6.2.1 - 2020-10-15T07:26:12

Bug fixes

  • Changed synchronization method when responding to dynamic library image events to a dispatch queue, which is a more bulletproof and battle-hardened approach. 837

  • Fixed a deadlock which can occur when calling notify 833

v6.2.0 - 2020-10-08T08:12:30


  • An invalid or missing API key now causes an NSException to be thrown upon calling [Bugsnag start]. This check used to occur during configuration, and only for malformed API keys. 828

  • Exception Mach code and subcode are now written to the crash report as stringified hex values instead of integers to avoid potential data loss from JSON readers that lose the lower bits from unsigned 64-bit numbers. 827

  • Improved out-of-memory event detection by disabling reporting when a debugger is attached. OOM reporting is now enabled by default in debug builds. 820

v6.1.7 - 2020-10-01T08:48:09

Bug fixes

  • Re-enabled the Require Only App-Extension-Safe API build setting #823

  • Fix reporting of events with more than one error #821

v6.1.6 - 2020-09-24T11:31:23

Bug fixes

  • Fix crash-on-launch (attempt to insert into immutable dictionary). 819

v6.1.5 - 2020-09-23T13:22:56


  • Add +[Bugsnag breadcrumbs] to allow apps to fetch the list of breadcrumbs. 813

  • Disable JSON pretty-printing in KSCrash reports to save disk space and bandwidth. 802

Bug fixes

  • Fix reporting of Mach exception code and subcode. 806

  • Create date formatters at init time to avoid potential race conditions. 807

  • Refactor OOM handler to be less suceptible to data loss on crash. 804

v6.1.4 - 2020-09-14T10:02:17

Bug fixes

  • Copy the metadata observer list rather than mutating it directly. 796

  • Reorganized the project file 793

  • Removed some magic values and used the const string references instead. #792

  • Added BSGJSONSerializer, which ensures no exceptions get thrown (NSErrors get returned instead) 791

  • Guard against non-string metadata map keys #790

  • Quiet some Analyzer false positives #789

  • Avoid crash reporting OOMs if nil provided as codeBundleId #784

v6.1.3 - 2020-08-17T13:55:23

Bug fixes

  • Persist user when set on client #770

  • Avoid sharing global crash context when recording thread information for handled errors #766

  • Respect bundle version set from config #762

  • (React Native) Call react native observer with initial user/context values #768

  • (React Native) Populate app/device metadata fields for RN errors #763

v5.23.5 - 2020-07-27T13:24:17

Bug fixes

The following bug fixes have been applied to the v5 branch to provide a patch for users who have not yet upgraded to v6:

  • Fix JSON serialisation of strings with control characters 739

  • Removed non-thread safe date formatter #758

v6.1.2 - 2020-07-21T13:37:30

Bug fixes

  • Ensure foreground stats are recorded for handled errors #755

  • Synchronize access to sessions being delivered in de-duplication code #756

  • Removed non-thread safe date formatter #758

v6.1.1 - 2020-07-16T09:05:22

Bug fixes

  • Improve performance of thread capture #723 #727 #728

  • Improve thread-safety of breadcrumb count #743

  • Fix JSON serialisation of strings with control characters #739

  • Disable reporting of notable addresses from registers for handled errors #741

v6.1.0 - 2020-07-06T13:16:43


  • Add support for Swift Package Manager #729

v5.23.4 - 2020-07-06T09:01:02

Bug Fixes

The following bug fixes have been applied to the v5 branch to provide a patch for users who have not yet upgraded to v6:

  • Fix incorrect string comparison of thread names in Mach exception handling #721

  • Move binary images store declaration from header file #725

  • Avoid dereference null pointer in JSON serialisation #637 Naugladur

v6.0.1 - 2020-06-29T16:21:57

Bug Fixes

  • Move binary images store declaration from header file #725

  • Make stacktrace properties for error/thread readwrite #722

  • Fix incorrect string comparison of thread names in Mach exception handling #721

  • Address unterminated string in thread gathering logic #720

v6.0.0 - 2020-06-22T14:53:02

This version contains many breaking changes. It is part of an effort to unify our notifier libraries across platforms, making the user interface more consistent, and implementations better on multi-layered environments where multiple Bugsnag libraries need to work together (such as React Native).

Please see the upgrade guide for details of all the changes and instructions on how to upgrade.


  • Allow starting Bugsnag from PList #676

  • The comparison of redacted keys is now case-insensitive #653

  • Unified the three main XCode projects #633

  • Alter default session background timeout to 30s #581

  • Support loading configuration from values in Info.plist. #582

  • Add unhandledRejections to BugsnagErrorTypes #567

  • Rename Bugsnag start methods #566

  • Rename OnSend to OnSendError #562

  • Add onCrashHandler data to BugsnagEvent metadata #564

  • Rename BugsnagUser properties #560

  • Make BugsnagOnErrorBlock return BOOL rather than void #555

  • Make BugsnagPlugin take BugsnagClient as param #558

  • Make user editable on BugsnagEvent #557

  • Add getter for Bugsnag.context #554

  • Make BugsnagUser properties readonly #556

  • Add sendThreads property to BugsnagConfiguration #549

  • Hide additional methods from public API #552

  • Move codeBundleId from configuration to non-public client property #548

  • Add structured app/device fields to BugsnagSession #546

  • Add redactedKeys for removing sensitive values from metadata #540

  • Move endpoint configuration to class #542

  • Make all callbacks return boolean values #534

  • Add originalError property to BugsnagEvent #541

  • Remove attachCustomStacktrace from public API #547

  • Create structured BugsnagError class #533

  • Create structured BugsnagThread class #532

  • Convert event.device from NSDictionary to a structured class #526

  • Create structured BugsnagStackframe class #528

  • Convert event.app from NSDictionary to a structured class #520 #600

  • Make BugsnagClient a public interface #517

  • Remove unused APIs from Bugsnag interface #514

  • Enforce that config.maxBreadcrumbs must be between 0-100 #511

  • Add unhandled property to BugsnagEvent #512

  • Rename notifyReleaseStages to enabledReleaseStages #509

  • Remove unused APIs from BugsnagSession interface #506

  • Rename setUser/user interface on Bugsnag and BugsnagConfiguration #505

  • Rename config.notifierType to config.appType #504

  • Remove unused APIs on BugsnagEvent interface #498

  • Allow addition/removal of OnBreadcrumb callbacks #508

  • Remove unused APIs from BugsnagMetadata interface #501

  • Remove unused APIs from BugsnagConfiguration interface #496

  • Remove unused APIs from BugsnagBreadcrumb interface #502

  • Remove notify method variants from public api on Bugsnag #497

  • Remove leaveBreadcrumbWithBlock from public api on Bugsnag #491

  • BugsnagNotifier is now BugsnagClient #480

  • Remove setSuspendThreadsForUserReported, setReportWhenDebuggerIsAttached, setThreadTracingEnabled, setWriteBinaryImagesForUserReported from public API. #468

  • Fixes typo in BSG_KSCDeleteOnSuccess enumeration #317

  • Add a breadcrumb when Bugsnag first starts with the message "Bugsnag loaded" #445

  • BugsnagMetaData is now BugsnagMetadata, including the configuration and event fields #450

  • BugsnagCrashReport is now BugsnagEvent #449

  • Add a configuration option to filter breadcrumbs by type. Use config.enabledBreadcrumbTypes to enable or disable particular types of breadcrumbs from being captured. #476

  • Added a designated initializer to BugsnagConfiguration and removed functionality from the default convenience init() to ensure that apiKey has a value set. The apiKey must now be a correctly formatted one to be accepted.

    • Swift: BugsnagConfiguration(_ apiKey)
    • Objective C: [[BugsnagConfiguration alloc] initWithApiKey:]

    #446 #492

  • Support editing breadcrumbs within an Event as objects. Breadcrumbs can now be inspected and modified from callbacks, for example:

    Bugsnag.notifyError(error) { event in
        event.breadcrumbs?.forEach({ crumb in
            if crumb.message == "something specific" {
                crumb.message = "[redacted]"


  • Bugsnag.addAttribute:value:tab: is now Bugsnag.addMetadataToSection:key:value: #454

  • [Bugsnag clearTab:] is now [Bugsnag clearMetadataInSection:] (Swift: Bugsnag.clearMetadata(section:)) #457

  • Renamed callback functions in the Configuration class:

    • beforeSendBlocks is now onSendBlocks (add using config.add(onSend: { ... }))
    • beforeSendSessionBlocks is now onSessionBlocks (add using config.add(onSession: { ... }))
  • Added [Bugsnag clearMetadataInSection:withKey:] (Swift: Bugsnag.clearMetadata(section:key:)) #462

  • Added Bugsnag.getMetadata(_ section). The behaviour is: calling with a valid section name will return the metadata for that section if it exists, or nil if it does not exist. Other, similar functionality (e.g. BugsnagConfiguration.getTab() has been renamed and had usage aligned with this change. #459

  • Added Bugsnag.getMetadata(_ section: key:) #463

  • Add a per-Event apiKey property. This defaults to the global BugsnagConfiguration value but can be overridden in event passed to the Bugsnag.notify() callback. #458

  • Added Bugsnag.context, replicating the BugsnagConfiguration property. This is mutable and may be changed at any point. Changes are propagated to the BugsnagConfiguration property. #466

  • Bugsnag.stopSession() is now Bugsnag.pauseSession(). This renaming has also been applied to the BugsnagNotifier and BugsnagSessionTracker classes. #464

  • Add a breadcrumb when network connectivity changes #448

  • Breadcrumbs now take a message parameter that can now be arbitrarily long. This simplifies breadcrumb creation using Bugsnag.leaveBreadcrumb(string) so that the value is prominently displayed and is not truncated. #433

  • Add metadata accessor methods to BugsnagEvent #465

  • Added a user-configurable enabledErrorTypes property to BugsnagConfiguration. The BugsnagErrorTypes property allows users to choose which types of events are reported. If automatic crash detection is disabled this value is ignored. User-generated notify() events are reported in all cases. #477 #561

  • Internal logging has been unified. Where before two preprocessor macros were required to configure both Bugsnag and KSCrash portions, now the Bugsnag BSG_LOG_LEVEL macro is sufficient to configure both. This should be set on the Bugsnag framework build target. Further configuration instructions can be found in the BugsnagLogger.h header. #472

  • Added a method to allow merging supplied and existing Event metadata. BugsnagMetadata.addMetadataToSection:values: allows Event callbacks to modify Event metadata en-mass. Supplied metadata should be a JSON-serializable dictionary. The resulting Event metadata is the result of applying the following rules to the existing metadata for each supplied value:

    • Non-null values replace any existing key/value pair.
    • Null values remove a key/value pair.
    • Invalid values are logged and ignored. #470
  • Remove Bugsnag.configuration()?. All access to the configuration object should be performed prior to calling Bugsnag.start().

  • User information is now persisted between application runs by default. When set a users' email, id and name are set on BugsnagConfiguration they are stored in the User Defaults and restored if an application is restarted. The values are also copied to the configuration metadata. #469 #590

  • Added callback-free method to leave breadcrumbs: [Bugsnag leaveBreadcrumbWithMessage:metadata:andType] (Swift: Bugsnag.leaveBreadcrumb(_, metadata:, type:)) #482

  • Added removeOnSessionBlock() methods to both Bugsnag and BugsnagConfiguration to allow removal of callbacks run when a session starts. #483

  • Added addOnSendBlock:, removeOnSendBlock: to BugsnagConfiguration. #485 #485

  • Enhanced device orientation change breadcrumbs. These are now reported with "from" and "to" values in a form consistent with the Android notifier. #486

  • The metadata interface is now consistent across the Bugsnag, BugsnagMetadata, BugsnagConfig, BugsnagClient and BugsnagEvent classes. #513

  • BugsnagClient now takes a shallow copy of the configuration passed in on initialisation. #524

  • The bundleVersion property is available on BugsnagConfiguration allowing overriding the default plist value. #550

  • Deliver each event in a separate request to avoid exceeding payload size limit #424

v6.0.0-rc9 - 2020-06-19T21:56:22

v6.0.0-rc8 - 2020-06-18T12:10:07

v6.0.0-rc7 - 2020-06-16T13:11:50

v6.0.0-rc6 - 2020-06-15T14:41:46

v6.0.0-rc5 - 2020-06-05T14:47:22

v5.23.3 - 2020-06-05T14:41:49

Bug Fixes

  • Fix DYLD lock mechanism preventing compilation on iOS <10. #675