/cocoa-1

Primary LanguageSwift

Cocoa/iOS Demo

Setup

In XCode:

Select th sentry-cocoa root folder to open the app profile:

  1. Set a SENTRY_AUTH_TOKEN in 'Run Script' build phase.

  2. Put your DSN key in sentry-cocoa/AppDelegate.swift

  3. sentry-cli must be installed at /usr/local/bin

  4. XCode Edit Schemes > 'Run' action for your scheme > Info tab > uncheck 'Debug executable' box.
    This ensures your app doesn't run in debugging mode, in which case unhandled exceptions won't send to Sentry.

  5. Click the Run/play button targeting iPhone 11

  6. In Simulator, Launch the sentry-cocoa app

  7. Press a button to generate an Error

How to Upgrade SDK

Check out a new branch so you can open a PR.

  1. Xcode -> Podfile, increment the sdk version.
  2. pod update
  3. Click 'Play' button

Flow/Demo

The demo app enriches every event with: Custom context, breadcrumbs, tags, user IP, extra data.

  1. From the Simulator explicitly send an event to Sentry by clicking
    • Handled Exception
    • Capture Message

Send Message

  1. For Native crashes click:
  • Crash Application
  • UnHandled Exception

Native Crash / Runtime Error

  1. Release:
  • Note that the cocoa-sdk automatically creates a Release by using the build version + dist as described in the Android SDK Release Version Format
  • The SDK then automatically tags every event with that release version id (i.e. there is no need to explicitly set the release version ID, unless you're explicitly setting a custom release name)
  1. Run Scripts:

    Upload the Debug Symbols to the target project and associate the commits to the release object.

Documentation/Resources

https://docs.sentry.io/clients/cocoa/

If you still enter debugging mode by accident, then click 'Stop' which will detach the debugger, then re-launch the app from the touch screen. Do not click 'Play' again or else the debugger will re-attach.

CrashApplication button makes "EXC_BAD_INSTRUCTION: Fatal error > procpath"

UnhandledException button makes "EXC_BAD_ACCESS:causeCrash: > crash > Attempted to derefer"

Crashes and unhandled exceptions will have stack traces for several threads. Messages and Handled exceptions will have stack trace for top-level thread.