ios.tsx 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. import ExternalLink from 'sentry/components/links/externalLink';
  2. import Link from 'sentry/components/links/link';
  3. import List from 'sentry/components/list/';
  4. import ListItem from 'sentry/components/list/listItem';
  5. import {StepType} from 'sentry/components/onboarding/gettingStartedDoc/step';
  6. import type {
  7. BasePlatformOptions,
  8. Docs,
  9. DocsParams,
  10. OnboardingConfig,
  11. } from 'sentry/components/onboarding/gettingStartedDoc/types';
  12. import {MobileBetaBanner} from 'sentry/components/onboarding/gettingStartedDoc/utils';
  13. import {metricTagsExplanation} from 'sentry/components/onboarding/gettingStartedDoc/utils/metricsOnboarding';
  14. import {
  15. getReplayMobileConfigureDescription,
  16. getReplayVerifyStep,
  17. } from 'sentry/components/onboarding/gettingStartedDoc/utils/replayOnboarding';
  18. import {appleFeedbackOnboarding} from 'sentry/gettingStartedDocs/apple/macos';
  19. import {t, tct} from 'sentry/locale';
  20. import {getPackageVersion} from 'sentry/utils/gettingStartedDocs/getPackageVersion';
  21. export enum InstallationMode {
  22. AUTO = 'auto',
  23. MANUAL = 'manual',
  24. }
  25. const platformOptions = {
  26. installationMode: {
  27. label: t('Installation Mode'),
  28. items: [
  29. {
  30. label: t('Auto'),
  31. value: InstallationMode.AUTO,
  32. },
  33. {
  34. label: t('Manual'),
  35. value: InstallationMode.MANUAL,
  36. },
  37. ],
  38. defaultValue:
  39. navigator.userAgent.indexOf('Win') !== -1
  40. ? InstallationMode.MANUAL
  41. : InstallationMode.AUTO,
  42. },
  43. } satisfies BasePlatformOptions;
  44. type PlatformOptions = typeof platformOptions;
  45. type Params = DocsParams<PlatformOptions>;
  46. const isAutoInstall = (params: Params) =>
  47. params.platformOptions.installationMode === InstallationMode.AUTO;
  48. const getAutoInstallSnippet = () =>
  49. `brew install getsentry/tools/sentry-wizard && sentry-wizard -i ios`;
  50. const getManualInstallSnippet = (params: Params) => `
  51. .package(url: "https://github.com/getsentry/sentry-cocoa", from: "${getPackageVersion(
  52. params,
  53. 'sentry.cocoa',
  54. '8.9.3'
  55. )}"),`;
  56. const getConfigurationSnippet = (params: Params) => `
  57. import Sentry
  58. // ....
  59. func application(_ application: UIApplication,
  60. didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
  61. SentrySDK.start { options in
  62. options.dsn = "${params.dsn.public}"
  63. options.debug = true // Enabling debug when first installing is always helpful${
  64. params.isPerformanceSelected
  65. ? `
  66. // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
  67. // We recommend adjusting this value in production.
  68. options.tracesSampleRate = 1.0`
  69. : ''
  70. }${
  71. params.isProfilingSelected &&
  72. params.profilingOptions?.defaultProfilingMode !== 'continuous'
  73. ? `
  74. // Sample rate for profiling, applied on top of TracesSampleRate.
  75. // We recommend adjusting this value in production.
  76. options.profilesSampleRate = 1.0`
  77. : ''
  78. }
  79. }${
  80. params.isProfilingSelected &&
  81. params.profilingOptions?.defaultProfilingMode === 'continuous'
  82. ? `
  83. // Manually call startProfiler and stopProfiler
  84. // to profile the code in between
  85. SentrySDK.startProfiler()
  86. // this code will be profiled
  87. //
  88. // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
  89. // your application until the process exits or stopProfiler is called.
  90. SentrySDK.stopProfiler()`
  91. : ''
  92. }
  93. return true
  94. }`;
  95. const getConfigurationSnippetSwiftUi = (params: Params) => `
  96. import Sentry
  97. @main
  98. struct SwiftUIApp: App {
  99. init() {
  100. SentrySDK.start { options in
  101. options.dsn = "${params.dsn.public}"
  102. options.debug = true // Enabling debug when first installing is always helpful${
  103. params.isPerformanceSelected
  104. ? `
  105. // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
  106. // We recommend adjusting this value in production.
  107. options.tracesSampleRate = 1.0`
  108. : ''
  109. }${
  110. params.isProfilingSelected &&
  111. params.profilingOptions?.defaultProfilingMode !== 'continuous'
  112. ? `
  113. // Sample rate for profiling, applied on top of TracesSampleRate.
  114. // We recommend adjusting this value in production.
  115. options.profilesSampleRate = 1.0`
  116. : ''
  117. }
  118. }${
  119. params.isProfilingSelected &&
  120. params.profilingOptions?.defaultProfilingMode === 'continuous'
  121. ? `
  122. // Manually call startProfiler and stopProfiler
  123. // to profile the code in between
  124. SentrySDK.startProfiler()
  125. // this code will be profiled
  126. //
  127. // Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
  128. // your application until the process exits or stopProfiler is called.
  129. SentrySDK.stopProfiler()`
  130. : ''
  131. }
  132. }
  133. }`;
  134. const getVerifySnippet = () => `
  135. let button = UIButton(type: .roundedRect)
  136. button.frame = CGRect(x: 20, y: 50, width: 100, height: 30)
  137. button.setTitle("Break the world", for: [])
  138. button.addTarget(self, action: #selector(self.breakTheWorld(_:)), for: .touchUpInside)
  139. view.addSubview(button)
  140. @IBAction func breakTheWorld(_ sender: AnyObject) {
  141. fatalError("Break the world")
  142. }`;
  143. const getExperimentalFeaturesSnippetSwift = () => `
  144. import Sentry
  145. SentrySDK.start { options in
  146. // ...
  147. // Enable all experimental features
  148. options.attachViewHierarchy = true
  149. options.enableMetricKit = true
  150. options.enableTimeToFullDisplayTracing = true
  151. options.swiftAsyncStacktraces = true
  152. options.enableAppLaunchProfiling = true
  153. }`;
  154. const getExperimentalFeaturesSnippetObjC = () => `
  155. @import Sentry;
  156. [SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
  157. // ...
  158. // Enable all experimental features
  159. options.attachViewHierarchy = YES;
  160. options.enableMetricKit = YES;
  161. options.enableTimeToFullDisplayTracing = YES;
  162. options.swiftAsyncStacktraces = YES;
  163. options.enableAppLaunchProfiling = YES;
  164. }];`;
  165. const getConfigureMetricsSnippetSwift = (params: Params) => `
  166. import Sentry
  167. SentrySDK.start { options in
  168. options.dsn = "${params.dsn.public}"
  169. options.enableMetrics = true
  170. }`;
  171. const getConfigureMetricsSnippetObjC = (params: Params) => `
  172. @import Sentry;
  173. [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
  174. options.Dsn = @"${params.dsn.public}";
  175. options.enableMetrics = YES;
  176. }];`;
  177. const getVerifyMetricsSnippetSwift = () => `
  178. import Sentry
  179. // Incrementing a counter by one for each button click.
  180. SentrySDK.metrics
  181. .increment(key: "button_login_click",
  182. value: 1.0,
  183. tags: ["screen": "login"]
  184. )
  185. // Add '150' to a distribution used to track the loading time.
  186. SentrySDK.metrics
  187. .distribution(key: "image_download_duration",
  188. value: 150.0,
  189. unit: MeasurementUnitDuration.millisecond,
  190. tags: ["screen": "login"]
  191. )
  192. // Adding '1' to a gauge used to track the loading time.
  193. SentrySDK.metrics
  194. .gauge(key: "page_load",
  195. value: 1.0,
  196. unit: MeasurementUnitDuration.millisecond,
  197. tags: ["screen": "login"]
  198. )
  199. // Add 'jane' to a set
  200. // used for tracking the number of users that viewed a page.
  201. SentrySDK.metrics
  202. .set(key: "user_view",
  203. value: "jane",
  204. unit: MeasurementUnit(unit: "username"),
  205. tags: ["screen": "login"]
  206. )`;
  207. const getVerifyMetricsSnippetObjC = () => `
  208. @import Sentry;
  209. // Incrementing a counter by one for each button click.
  210. [SentrySDK.metrics
  211. incrementWithKey :@"button_login_click"
  212. value: 1.0
  213. unit: SentryMeasurementUnit.none
  214. tags: @{ @"screen" : @"login" }
  215. ];
  216. // Add '150' to a distribution used to track the loading time.
  217. [SentrySDK.metrics
  218. distributionWithKey: @"image_download_duration"
  219. value: 150.0
  220. unit: SentryMeasurementUnitDuration.millisecond
  221. tags: @{ @"screen" : @"login" }
  222. ];
  223. // Adding '1' to a gauge used to track the loading time.
  224. [SentrySDK.metrics
  225. gaugeWithKey: @"page_load"
  226. value: 1.0
  227. unit: SentryMeasurementUnitDuration.millisecond
  228. tags: @{ @"screen" : @"login" }
  229. ];
  230. // Add 'jane' to a set
  231. // used for tracking the number of users that viewed a page.
  232. [SentrySDK.metrics
  233. setWithKey :@"user_view"
  234. value: @"jane"
  235. unit: [[SentryMeasurementUnit alloc] initWithUnit:@"username"]
  236. tags: @{ @"screen" : @"login" }
  237. ];`;
  238. const getReplaySetupSnippet = (params: Params) => `
  239. SentrySDK.start(configureOptions: { options in
  240. options.dsn = "${params.dsn.public}"
  241. options.debug = true
  242. // Currently under experimental options:
  243. options.experimental.sessionReplay.onErrorSampleRate = 1.0
  244. options.experimental.sessionReplay.sessionSampleRate = 1.0
  245. })`;
  246. const getReplayConfigurationSnippet = () => `
  247. options.experimental.sessionReplay.redactAllText = true
  248. options.experimental.sessionReplay.redactAllImages = true`;
  249. const onboarding: OnboardingConfig<PlatformOptions> = {
  250. install: params =>
  251. isAutoInstall(params)
  252. ? [
  253. {
  254. type: StepType.INSTALL,
  255. description: (
  256. <p>
  257. {tct(
  258. 'Add Sentry automatically to your app with the [wizardLink:Sentry wizard] (call this inside your project directory).',
  259. {
  260. wizardLink: (
  261. <ExternalLink href="https://docs.sentry.io/platforms/apple/guides/ios/#install" />
  262. ),
  263. }
  264. )}
  265. </p>
  266. ),
  267. configurations: [
  268. {
  269. language: 'bash',
  270. code: getAutoInstallSnippet(),
  271. },
  272. ],
  273. },
  274. ]
  275. : [
  276. {
  277. type: StepType.INSTALL,
  278. description: tct(
  279. 'We recommend installing the SDK with Swift Package Manager (SPM), but we also support [alternateMethods: alternate installation methods]. To integrate Sentry into your Xcode project using SPM, open your App in Xcode and open [addPackage: File > Add Packages]. Then add the SDK by entering the Git repo url in the top right search field:',
  280. {
  281. alternateMethods: (
  282. <ExternalLink href="https://docs.sentry.io/platforms/apple/install/" />
  283. ),
  284. addPackage: <strong />,
  285. }
  286. ),
  287. configurations: [
  288. {
  289. language: 'url',
  290. code: `https://github.com/getsentry/sentry-cocoa.git`,
  291. },
  292. {
  293. description: (
  294. <p>
  295. {tct(
  296. 'Alternatively, when your project uses a [packageSwift: Package.swift] file to manage dependencies, you can specify the target with:',
  297. {
  298. packageSwift: <code />,
  299. }
  300. )}
  301. </p>
  302. ),
  303. language: 'swift',
  304. partialLoading: params.sourcePackageRegistries.isLoading,
  305. code: getManualInstallSnippet(params),
  306. },
  307. ],
  308. },
  309. ],
  310. configure: params =>
  311. isAutoInstall(params)
  312. ? [
  313. {
  314. type: StepType.CONFIGURE,
  315. description: t(
  316. 'The Sentry wizard will automatically patch your application:'
  317. ),
  318. configurations: [
  319. {
  320. description: (
  321. <List symbol="bullet">
  322. <ListItem>
  323. {t('Install the Sentry SDK via Swift Package Manager or Cocoapods')}
  324. </ListItem>
  325. <ListItem>
  326. {tct(
  327. 'Update your [appDelegate: AppDelegate] or SwiftUI App Initializer with the default Sentry configuration and an example error',
  328. {
  329. appDelegate: <code />,
  330. }
  331. )}
  332. </ListItem>
  333. <ListItem>
  334. {tct(
  335. 'Add a new [code: Upload Debug Symbols] phase to your [code: xcodebuild] build script',
  336. {
  337. code: <code />,
  338. }
  339. )}
  340. </ListItem>
  341. <ListItem>
  342. {tct(
  343. 'Create [code: .sentryclirc] with an auth token to upload debug symbols (this file is automatically added to [code: .gitignore])',
  344. {
  345. code: <code />,
  346. }
  347. )}
  348. </ListItem>
  349. <ListItem>
  350. {t(
  351. "When you're using Fastlane, it will add a Sentry lane for uploading debug symbols"
  352. )}
  353. </ListItem>
  354. </List>
  355. ),
  356. additionalInfo: tct(
  357. 'Alternatively, you can also [manualSetupLink:set up the SDK manually].',
  358. {
  359. manualSetupLink: (
  360. <ExternalLink href="https://docs.sentry.io/platforms/apple/guides/ios/manual-setup/" />
  361. ),
  362. stepsBelow: <strong />,
  363. }
  364. ),
  365. },
  366. ],
  367. },
  368. ]
  369. : [
  370. {
  371. type: StepType.CONFIGURE,
  372. description: (
  373. <p>
  374. {tct(
  375. 'Make sure you initialize the SDK as soon as possible in your application lifecycle e.g. in your [appDelegate:] method:',
  376. {
  377. appDelegate: (
  378. <code>
  379. - [UIAppDelegate application:didFinishLaunchingWithOptions:]
  380. </code>
  381. ),
  382. }
  383. )}
  384. </p>
  385. ),
  386. configurations: [
  387. {
  388. language: 'swift',
  389. code: getConfigurationSnippet(params),
  390. },
  391. {
  392. description: (
  393. <p>
  394. {tct(
  395. "When using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the [initializer: App conformer's initializer]:",
  396. {
  397. initializer: (
  398. <ExternalLink href="https://developer.apple.com/documentation/swiftui/app/main()" />
  399. ),
  400. }
  401. )}
  402. </p>
  403. ),
  404. language: 'swift',
  405. code: getConfigurationSnippetSwiftUi(params),
  406. },
  407. ],
  408. },
  409. ],
  410. verify: params =>
  411. isAutoInstall(params)
  412. ? [
  413. {
  414. type: StepType.VERIFY,
  415. description: t(
  416. 'The Sentry wizard automatically adds a code snippet that captures a message to your project. Simply run your app and you should see this message in your Sentry project.'
  417. ),
  418. },
  419. {
  420. title: t('Experimental Features'),
  421. description: tct(
  422. 'Want to play with some new features? Try out our experimental features for [vh: View Hierarchy], [ttfd: Time to Full Display (TTFD)], [metricKit: MetricKit], [prewarmedAppStart: Prewarmed App Start Tracing], and [asyncStacktraces: Swift Async Stacktraces]. Experimental features are still a work-in-progress and may have bugs. We recognize the irony. [break] Let us know if you have feedback through [gh: GitHub issues].',
  423. {
  424. vh: (
  425. <ExternalLink href="https://docs.sentry.io/platforms/apple/guides/ios/enriching-events/viewhierarchy/" />
  426. ),
  427. ttfd: (
  428. <ExternalLink href="https://docs.sentry.io/platforms/apple/guides/ios/tracing/instrumentation/automatic-instrumentation/#time-to-full-display" />
  429. ),
  430. metricKit: (
  431. <ExternalLink href="https://docs.sentry.io/platforms/apple/guides/watchos/configuration/metric-kit/" />
  432. ),
  433. prewarmedAppStart: (
  434. <ExternalLink href="https://docs.sentry.io/platforms/apple/tracing/instrumentation/automatic-instrumentation/#prewarmed-app-start-tracing" />
  435. ),
  436. asyncStacktraces: (
  437. <ExternalLink href="https://docs.sentry.io/platforms/apple/guides/ios/#stitch-together-swift-concurrency-stack-traces" />
  438. ),
  439. gh: (
  440. <ExternalLink href="https://github.com/getsentry/sentry-cocoa/issues" />
  441. ),
  442. break: <br />,
  443. }
  444. ),
  445. configurations: [
  446. {
  447. code: [
  448. {
  449. label: 'Swift',
  450. value: 'swift',
  451. language: 'swift',
  452. code: getExperimentalFeaturesSnippetSwift(),
  453. },
  454. {
  455. label: 'Objective-C',
  456. value: 'c',
  457. language: 'c',
  458. code: getExperimentalFeaturesSnippetObjC(),
  459. },
  460. ],
  461. },
  462. ],
  463. },
  464. ]
  465. : [
  466. {
  467. type: StepType.VERIFY,
  468. description: (
  469. <p>
  470. {tct(
  471. 'This snippet contains an intentional error you can use to test that errors are uploaded to Sentry correctly. You can add it to your main [viewController: ViewController].',
  472. {
  473. viewController: <code />,
  474. }
  475. )}
  476. </p>
  477. ),
  478. configurations: [
  479. {
  480. language: 'swift',
  481. code: getVerifySnippet(),
  482. },
  483. ],
  484. },
  485. ],
  486. nextSteps: () => [
  487. {
  488. id: 'cocoapods-carthage',
  489. name: t('CocoaPods/Carthage'),
  490. description: t(
  491. 'Learn about integrating Sentry into your project using CocoaPods or Carthage.'
  492. ),
  493. link: 'https://docs.sentry.io/platforms/apple/install/',
  494. },
  495. {
  496. id: 'debug-symbols',
  497. name: t('Debug Symbols'),
  498. description: t('Symbolicate and get readable stacktraces in your Sentry errors.'),
  499. link: 'https://docs.sentry.io/platforms/apple/dsym/',
  500. },
  501. {
  502. id: 'swiftui',
  503. name: t('SwiftUI'),
  504. description: t('Learn about our first class integration with SwiftUI.'),
  505. link: 'https://docs.sentry.io/platforms/apple/tracing/instrumentation/swiftui-instrumentation/',
  506. },
  507. ],
  508. };
  509. const metricsOnboarding: OnboardingConfig<PlatformOptions> = {
  510. install: (params: Params) => [
  511. {
  512. type: StepType.INSTALL,
  513. description: tct(
  514. 'You need Sentry Cocoa SDK version [codeVersion:8.23.0] or higher. Learn more about installation methods in our [docsLink:full documentation].',
  515. {
  516. codeVersion: <code />,
  517. docsLink: <Link to={`/projects/${params.projectSlug}/getting-started/`} />,
  518. }
  519. ),
  520. configurations: [
  521. {
  522. language: 'yml',
  523. partialLoading: params.sourcePackageRegistries?.isLoading,
  524. code: getAutoInstallSnippet(),
  525. },
  526. ],
  527. },
  528. ],
  529. configure: (params: Params) => [
  530. {
  531. type: StepType.CONFIGURE,
  532. description: t(
  533. 'To enable capturing metrics, you need to enable the metrics feature.'
  534. ),
  535. configurations: [
  536. {
  537. code: [
  538. {
  539. label: 'Swift',
  540. value: 'swift',
  541. language: 'swift',
  542. code: getConfigureMetricsSnippetSwift(params),
  543. },
  544. {
  545. label: 'Objective-C',
  546. value: 'c',
  547. language: 'c',
  548. code: getConfigureMetricsSnippetObjC(params),
  549. },
  550. ],
  551. },
  552. ],
  553. },
  554. ],
  555. verify: () => [
  556. {
  557. type: StepType.VERIFY,
  558. description: tct(
  559. "Then you'll be able to add metrics as [code:counters], [code:sets], [code:distributions], and [code:gauges]. These are available under the [code:SentrySDK.metrics()] namespace.",
  560. {
  561. code: <code />,
  562. }
  563. ),
  564. configurations: [
  565. {
  566. description: metricTagsExplanation,
  567. },
  568. {
  569. description: t('Try out these examples:'),
  570. code: [
  571. {
  572. label: 'Swift',
  573. value: 'swift',
  574. language: 'swift',
  575. code: getVerifyMetricsSnippetSwift(),
  576. },
  577. {
  578. label: 'Objective-C',
  579. value: 'c',
  580. language: 'c',
  581. code: getVerifyMetricsSnippetObjC(),
  582. },
  583. ],
  584. },
  585. {
  586. description: t(
  587. 'It can take up to 3 minutes for the data to appear in the Sentry UI.'
  588. ),
  589. },
  590. {
  591. description: tct(
  592. 'Learn more about metrics and how to configure them, by reading the [docsLink:docs].',
  593. {
  594. docsLink: (
  595. <ExternalLink href="https://docs.sentry.io/platforms/apple/metrics/" />
  596. ),
  597. }
  598. ),
  599. },
  600. ],
  601. },
  602. ],
  603. };
  604. const replayOnboarding: OnboardingConfig<PlatformOptions> = {
  605. introduction: () => (
  606. <MobileBetaBanner link="https://docs.sentry.io/platforms/android/session-replay/" />
  607. ),
  608. install: (params: Params) => [
  609. {
  610. type: StepType.INSTALL,
  611. description: t(
  612. 'Make sure your Sentry Cocoa SDK version is at least 8.31.1. If you already have the SDK installed, you can update it to the latest version with:'
  613. ),
  614. configurations: [
  615. {
  616. code: [
  617. {
  618. label: 'SPM',
  619. value: 'spm',
  620. language: 'swift',
  621. code: `.package(url: "https://github.com/getsentry/sentry-cocoa", from: "${getPackageVersion(
  622. params,
  623. 'sentry.cocoa',
  624. '8.36.0'
  625. )}"),`,
  626. },
  627. {
  628. label: 'CocoaPods',
  629. value: 'cocoapods',
  630. language: 'ruby',
  631. code: `pod update`,
  632. },
  633. {
  634. label: 'Carthage',
  635. value: 'carthage',
  636. language: 'swift',
  637. code: `github "getsentry/sentry-cocoa" "${getPackageVersion(
  638. params,
  639. 'sentry.cocoa',
  640. '8.36.0'
  641. )}"`,
  642. },
  643. ],
  644. },
  645. {
  646. description: t(
  647. 'To set up the integration, add the following to your Sentry initialization:'
  648. ),
  649. },
  650. {
  651. code: [
  652. {
  653. label: 'Swift',
  654. value: 'swift',
  655. language: 'swift',
  656. code: getReplaySetupSnippet(params),
  657. },
  658. ],
  659. },
  660. ],
  661. },
  662. ],
  663. configure: () => [
  664. {
  665. type: StepType.CONFIGURE,
  666. description: getReplayMobileConfigureDescription({
  667. link: 'https://docs.sentry.io/platforms/apple/guides/ios/session-replay/#privacy',
  668. }),
  669. configurations: [
  670. {
  671. description: t(
  672. 'The following code is the default configuration, which masks and blocks everything.'
  673. ),
  674. code: [
  675. {
  676. label: 'Swift',
  677. value: 'swift',
  678. language: 'swift',
  679. code: getReplayConfigurationSnippet(),
  680. },
  681. ],
  682. },
  683. ],
  684. },
  685. ],
  686. verify: getReplayVerifyStep({
  687. replayOnErrorSampleRateName:
  688. 'options\u200b.experimental\u200b.sessionReplay\u200b.onErrorSampleRate',
  689. replaySessionSampleRateName:
  690. 'options\u200b.experimental\u200b.sessionReplay\u200b.sessionSampleRate',
  691. }),
  692. nextSteps: () => [],
  693. };
  694. const docs: Docs<PlatformOptions> = {
  695. onboarding,
  696. feedbackOnboardingCrashApi: appleFeedbackOnboarding,
  697. crashReportOnboarding: appleFeedbackOnboarding,
  698. customMetricsOnboarding: metricsOnboarding,
  699. platformOptions,
  700. replayOnboarding,
  701. };
  702. export default docs;