-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
apple.mdx
102 lines (77 loc) · 3.64 KB
/
apple.mdx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
You should also initialize the SDK as soon as possible, such as in your AppDelegate `application:didFinishLaunchingWithOptions` method:
```swift {tabTitle:Swift}
import Sentry // Make sure you import Sentry
// ....
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SentrySDK.start { options in
options.dsn = "___PUBLIC_DSN___"
options.debug = true // Enabled debug when first installing is always helpful
// Features turned off by default, but worth checking out
options.enableAppHangTracking = true
options.enableFileIOTracking = true
options.enableCoreDataTracking = true
}
return true
}
```
```objc {tabTitle:Objective-C}
@import Sentry;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
options.dsn = @"___PUBLIC_DSN___";
options.debug = YES; // Enabled debug when first installing is always helpful
// Features turned off by default, but worth checking out
options.enableAppHangTracking = YES;
options.enableFileIOTracking = YES;
options.enableCoreDataTracking = YES;
}];
return YES;
}
```
When using SwiftUI and your app doesn't implement an app delegate, initialize the SDK within the [App conformer's initializer](https://developer.apple.com/documentation/swiftui/app/main()):
```swift
import Sentry
@main
struct SwiftUIApp: App {
init() {
SentrySDK.start { options in
options.dsn = "___PUBLIC_DSN___"
options.debug = true // Enabled debug when first installing is always helpful
// Features turned off by default, but worth checking out
options.enableAppHangTracking = true
options.enableFileIOTracking = true
options.enableCoreDataTracking = true
}
}
}
```
<!-- You can't write SwiftUI in Objective-C. Therefore no code sample. -->
## Experimental features
> Want to play with some new features? Try out our experimental features for [file I/O](/platforms/apple/performance/instrumentation/automatic-instrumentation/#file-io-instrumentation), [Core Data](/platforms/apple/performance/instrumentation/automatic-instrumentation/#core-data-instrumentation), [User Interaction Instrumentation](/platforms/apple/performance/instrumentation/automatic-instrumentation/#user-interaction-instrumentation), [Screenshots](https://docs.sentry.io/platforms/apple/guides/ios/enriching-events/screenshots/). Experimental features are still a work-in-progress and may have bugs. We recognize the irony.
>
> Let us know if you have feedback through [GitHub issues](https://github.com/getsentry/sentry-cocoa/issues).
```swift {tabTitle:Swift}
import Sentry
SentrySDK.start { options in
// ...
// Enable all experimental features
options.enableUserInteractionTracing = true
options.attachScreenshot = true
options.attachViewHierarchy = true
}
```
```objc {tabTitle:Objective-C}
@import Sentry;
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
// ...
// Enable all experimental features
options.enableUserInteractionTracing = YES;
options.attachScreenshot = YES;
options.attachViewHierarchy = YES;
}];
```
## Provide Debug Information {#debug-symbols}
Before capturing crashes, you need to provide debug information to Sentry. Debug information is provided by uploading dSYM files using one of two methods, dependent on your setup:
- [With Bitcode](dsym/#dsym-with-bitcode)
- [Without Bitcode](dsym/#dsym-without-bitcode)