{"componentChunkName":"component---src-templates-platform-tsx","path":"/platforms/apple/guides/ios/usage/","result":{"data":{"file":{"id":"14252b73-2394-5f7a-95fc-24ae39676b4d","relativePath":"apple/common/usage.mdx","sourceInstanceName":"platforms","childMarkdownRemark":null,"childMdx":{"body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"draft\": false,\n  \"categories\": [],\n  \"toc\": true,\n  \"title\": \"Advanced Usage\",\n  \"tags\": []\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar PlatformContent = makeShortcode(\"PlatformContent\");\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", {\n    \"id\": \"capturing-uncaught-exceptions-on-macos\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#capturing-uncaught-exceptions-on-macos\",\n    \"aria-label\": \"capturing uncaught exceptions on macos permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Capturing uncaught exceptions on macOS\"), mdx(\"p\", null, \"By default, MacOS applications do not crash whenever an uncaught exception occurs. To enable this with Sentry:\"), mdx(\"ul\", null, mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Open the application's \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"Info.plist\"), \" file\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Search for \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"Principal class\"), \" (the entry is expected to be NSApplication)\"), mdx(\"li\", {\n    parentName: \"ul\"\n  }, \"Replace \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"NSApplication\"), \" with \", mdx(\"inlineCode\", {\n    parentName: \"li\"\n  }, \"SentryCrashExceptionApplication\"))), mdx(\"h2\", {\n    \"id\": \"dealing-with-scopes\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#dealing-with-scopes\",\n    \"aria-label\": \"dealing with scopes permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Dealing with Scopes\"), mdx(\"p\", null, \"There are three different ways to interact with Scopes in the SDK. Either using \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"#scope-configureScope\"\n  }), \"configureScope\"), \", \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"#scope-pass\"\n  }), \"passing a scope\"), \" or using the \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"#scope-callback\"\n  }), \"scope callback\"), \".\"), mdx(\"h3\", {\n    \"id\": \"scope-configureScope\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#scope-configureScope\",\n    \"aria-label\": \"scope configureScope permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"configureScope\"), mdx(\"p\", null, \"Using \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"SentrySDK:configureScope\"), \" lets you set context data globally, which will be attached to all future events.\"), mdx(PlatformContent, {\n    includePath: \"configure-scope\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"h3\", {\n    \"id\": \"scope-pass\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#scope-pass\",\n    \"aria-label\": \"scope pass permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Passing a Scope Instance\"), mdx(\"p\", null, \"Setting an instance of Scope is helpful when you want to completely control what should be attached to the event.\\nThis is helpful in cases where you completely want to control what should be attached to the event.\"), mdx(PlatformContent, {\n    includePath: \"cocoa/pass-scope\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"h3\", {\n    \"id\": \"scope-callback\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h3\"\n  }, {\n    \"href\": \"#scope-callback\",\n    \"aria-label\": \"scope callback permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Using Scope Callback\"), mdx(\"p\", null, \"To maintain global state, but mutate context data for one capture call, use the Scope callback:\"), mdx(PlatformContent, {\n    includePath: \"cocoa/scope-callback\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"h2\", {\n    \"id\": \"integrations\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h2\"\n  }, {\n    \"href\": \"#integrations\",\n    \"aria-label\": \"integrations permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"Integrations\"), mdx(\"p\", null, \"The SDK enables all integrations by default. To disable any of them:\"), mdx(PlatformContent, {\n    includePath: \"cocoa/integrations\",\n    mdxType: \"PlatformContent\"\n  }), mdx(\"h4\", {\n    \"id\": \"sentrycrashintegration\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h4\"\n  }, {\n    \"href\": \"#sentrycrashintegration\",\n    \"aria-label\": \"sentrycrashintegration permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"SentryCrashIntegration\"), mdx(\"p\", null, \"This integration is the core part of the SDK. It hooks into all signal and exception handlers to capture uncaught errors or crashes. This integration is also responsible for adding most of the device information to events. If it is disabled, you will not receive crash reports, nor will events contain much device data.\"), mdx(\"h4\", {\n    \"id\": \"sentryautobreadcrumbtrackingintegration\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", _extends({\n    parentName: \"h4\"\n  }, {\n    \"href\": \"#sentryautobreadcrumbtrackingintegration\",\n    \"aria-label\": \"sentryautobreadcrumbtrackingintegration permalink\",\n    \"className\": \"anchor before\"\n  }), mdx(\"svg\", _extends({\n    parentName: \"a\"\n  }, {\n    \"viewBox\": \"0 0 24 24\",\n    \"xmlns\": \"http://www.w3.org/2000/svg\"\n  }), mdx(\"path\", _extends({\n    parentName: \"svg\"\n  }, {\n    \"d\": \"M10.879 6.05L15 1.93A5.001 5.001 0 0 1 22.071 9l-4.121 4.121a1 1 0 0 1-1.414-1.414l4.12-4.121a3 3 0 1 0-4.242-4.243l-4.121 4.121a1 1 0 1 1-1.414-1.414zm2.242 11.9L9 22.07A5 5 0 1 1 1.929 15l4.121-4.121a1 1 0 0 1 1.414 1.414l-4.12 4.121a3 3 0 1 0 4.242 4.243l4.121-4.121a1 1 0 1 1 1.414 1.414zm-8.364-.122l13.071-13.07a1 1 0 0 1 1.415 1.414L6.172 19.242a1 1 0 1 1-1.415-1.414z\",\n    \"fill\": \"currentColor\"\n  })))), \"SentryAutoBreadcrumbTrackingIntegration\"), mdx(\"p\", null, \"This integration will swizzle some methods to create breadcrumbs e.g.: for \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"UIApplicationDidReceiveMemoryWarningNotification\"), \", \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"sendAction:to:from:forEvent:\"), \" (UI interactions) or \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"viewDidAppear:\"), \" those breadcrumbs will be attached to your events.\"));\n}\n;\nMDXContent.isMDXComponent = true;","tableOfContents":{"items":[{"url":"#capturing-uncaught-exceptions-on-macos","title":"Capturing uncaught exceptions on macOS"},{"url":"#dealing-with-scopes","title":"Dealing with Scopes","items":[{"url":"#configurescope-scope-configurescope","title":"configureScope {#scope-configureScope}"},{"url":"#passing-a-scope-instance-scope-pass","title":"Passing a Scope Instance {#scope-pass}"},{"url":"#using-scope-callback-scope-callback","title":"Using Scope Callback {#scope-callback}"}]},{"url":"#integrations","title":"Integrations","items":[{"items":[{"url":"#sentrycrashintegration","title":"SentryCrashIntegration"},{"url":"#sentryautobreadcrumbtrackingintegration","title":"SentryAutoBreadcrumbTrackingIntegration"}]}]}]},"internal":{"type":"Mdx"}}}},"pageContext":{"excerpt":"Capturing uncaught exceptions on macOS By default, MacOS applications do not crash whenever an uncaught exception occurs. To enable this with Sentry: Open the application's  Info.plist  file Search for  Principal class  (the entry is expected to be NSApplication) Replace  NSApplication  with  SentryCrashExceptionApplication Dealing with Scopes There are three different ways to interact with Scopes in the SDK. Either using  configureScope ,  passing a scope  or using the  scope callback . configureScope {#scope-configureScope} Using  SentrySDK:configureScope  lets you set context data globally, which will be attached to all future events. Passing a Scope Instance {#scope-pass} Setting an instance of Scope is helpful when you want to completely control what should be attached to the event.\nThis is helpful in cases where you completely want to control what should be attached to the event. Using Scope Callback {#scope-callback} To maintain global state, but mutate context data for one capture call, use the Scope callback: Integrations The SDK enables all integrations by default. To disable any of them: SentryCrashIntegration This integration is the core part of the SDK. It hooks into all signal and exception handlers to capture uncaught errors or crashes. This integration is also responsible for adding most of the device information to events. If it is disabled, you will not receive crash reports, nor will events contain much device data. SentryAutoBreadcrumbTrackingIntegration This integration will swizzle some methods to create breadcrumbs e.g.: for  UIApplicationDidReceiveMemoryWarningNotification ,  sendAction:to:from:forEvent:  (UI interactions) or  viewDidAppear:  those breadcrumbs will be attached to your events.","title":"Advanced Usage","platform":{"name":"apple","title":"Apple"},"guide":{"name":"ios","title":"iOS"},"noindex":true,"notoc":true,"redirect_from":[],"id":"14252b73-2394-5f7a-95fc-24ae39676b4d"}},"staticQueryHashes":["1218203755","1222113826","1222113826","1766336459","2158593473","2404336828","2472290386","2764967025","3818502851","4015007367","4192517163","4264099332","518019976"]}