{ "html": "
The SDK can be installed using CocoaPods or Carthage.\nThis is the recommended client for both Swift and Objective-C.
\nWe recommend installing Sentry with CocoaPods.
\nTo integrate Sentry into your Xcode project using CocoaPods, specify\nit in your Podfile:
\nsource 'https://github.com/CocoaPods/Specs.git'\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget 'YourApp' do\n pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '3.9.1'\nend\n
If you want to use Sentry without KSCrash you can just remove it from the subspecs.\nKeep in mind that if you are not using KSCrash no events will be reported whenever you app crashes.\nAlso some function might do nothing if they are related to KSCrash.
\nAfterwards run pod install
. In case you encounter problems with\ndependencies and you are on a newer CocoaPods you might have to run\npod repo update
first.
To integrate Sentry into your Xcode project using Carthage, specify\nit in your Cartfile:
\ngithub "getsentry/sentry-cocoa" "3.9.1"\n
Run carthage update
to download the framework and drag the built\nSentry.framework into your Xcode project.
Note that for Carthage we had to bundle KSCrash into the Sentry.framework
to make everything work. So you will always get KSCrash with Sentry when using Carthage.
We also provide a prebuilt version for every release which can be downloaded at releases on github.
\nTo use the client, change your AppDelegate’s application method to\ninstantiate the Sentry client:
\nimport Sentry\n\nfunc application(application: UIApplication,\n didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {\n\n // Create a Sentry client and start crash handler\n do {\n Client.shared = try Client(dsn: "___DSN___")\n try Client.shared?.startCrashHandler()\n } catch let error {\n print("\\(error)")\n // Wrong DSN or KSCrash not installed\n }\n\n return true\n}\n
If you prefer to use Objective-C you can do so like this:
\n@import Sentry;\n\nNSError *error = nil;\nSentryClient *client = [[SentryClient alloc] initWithDsn:@"___DSN___" didFailWithError:&error];\nSentryClient.sharedClient = client;\n[SentryClient.sharedClient startCrashHandlerWithError:&error];\nif (nil != error) {\n NSLog(@"%@", error);\n}\n
Note that if you call startCrashHandler
will only catch errors if KSCrash is present.
Before you can start capturing crashes you will need to tell Sentry about the debug\ninformation by uploading dSYM files. Depending on your setup this can be\ndone in different ways:
\n\nYour project’s dSYM can be upload during the build phase as a “Run\nScript”. For this you need to st the DEBUG_INFORMATION_FORMAT to be\nDWARF with dSYM File. By default, an Xcode project will only have\nDEBUG_INFORMATION_FORMAT set to DWARF with dSYM File in Release so\nmake sure everything is set in your build settings properly.
\nYou need to have an Auth Token for this to work. You can create an\nAuth Token here.
\nShell: /bin/bash
\nif which sentry-cli >/dev/null; then\nexport SENTRY_ORG=___ORG_NAME___\nexport SENTRY_PROJECT=___PROJECT_NAME___\nexport SENTRY_AUTH_TOKEN=YOUR_AUTH_TOKEN\nERROR=$(sentry-cli upload-dsym 2>&1 >/dev/null)\nif [ ! $? -eq 0 ]; then\necho "warning: sentry-cli - $ERROR"\nfi\nelse\necho "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"\nfi\n
The upload-dsym
command automatically picks up the\nDWARF_DSYM_FOLDER_PATH
environment variable that Xcode exports and\nlook for dSYM files there.
On Prem
\nBy default sentry-cli will connect to sentry.io. For\non-prem you need to export the SENTRY_URL environment variable\nto instruct the tool to connect to your server:
\nexport SENTRY_URL=https://mysentry.invalid/\n