Skip to content

Commit 649dcd9

Browse files
authored
chore(Apple): Show Profiling only on supported platforms' landing pages (#12192)
* fixes duplicate feature descriptions * fix snippets, show profiling only where supported
1 parent e687544 commit 649dcd9

File tree

1 file changed

+101
-25
lines changed

1 file changed

+101
-25
lines changed

docs/platforms/apple/common/index.mdx

Lines changed: 101 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,34 @@ The support for [visionOS](https://developer.apple.com/visionos/) is currently e
1818

1919
## Features
2020

21+
<PlatformSection notSupported={["apple.tvos", "apple.watchos", "apple.visionos"]}>
22+
2123
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also collect and analyze performance profiles from real users with [profiling](/product/explore/profiling/).
2224

25+
</PlatformSection>
26+
27+
<PlatformSection notSupported={["apple.ios", "apple.macos"]}>
28+
29+
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/).
30+
31+
</PlatformSection>
32+
2333
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
2434

2535
## Install
2636

27-
<OnboardingOptionButtons
28-
options={[
29-
'error-monitoring',
30-
'performance',
31-
'profiling',
32-
]}
33-
/>
37+
<PlatformSection notSupported={["apple.tvos", "apple.watchos", "apple.visionos"]}>
38+
39+
<OnboardingOptionButtons options={['error-monitoring', 'performance', 'profiling']}/>
40+
41+
</PlatformSection>
42+
43+
<PlatformSection notSupported={["apple.ios", "apple.macos"]}>
44+
45+
<OnboardingOptionButtons options={['error-monitoring', 'performance']}/>
46+
47+
</PlatformSection>
48+
3449

3550
Sentry captures data by using an SDK within your application's runtime. These are platform-specific and allow Sentry to have a deep understanding of how your application works.
3651

@@ -70,8 +85,9 @@ If you prefer, you can also [set up the SDK manually](/platforms/apple/guides/io
7085

7186
To capture all errors, initialize the SDK as soon as possible, such as in your `AppDelegate` `application:didFinishLaunchingWithOptions` method:
7287

88+
<PlatformSection notSupported={["apple.tvos", "apple.watchos", "apple.visionos"]}>
7389

74-
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12", "profiling": "13-16"}}
90+
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12", "profiling": "14-24"}}
7591
import Sentry
7692

7793
func application(_ application: UIApplication,
@@ -86,22 +102,22 @@ func application(_ application: UIApplication,
86102
options.tracesSampleRate = 1.0
87103
}
88104

89-
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
90-
SentrySDK.startProfiler()
105+
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
106+
SentrySDK.startProfiler()
91107

92-
//
93-
// ...anything here will be profiled...
94-
//
108+
//
109+
// ...anything here will be profiled...
110+
//
95111

96-
// Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
97-
// your application until the process exits, the app goes to the background, or stopProfiling is called.
98-
SentrySDK.stopProfiler()
112+
// Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
113+
// your application until the process exits, the app goes to the background, or stopProfiling is called.
114+
SentrySDK.stopProfiler()
99115

100116
return true
101117
}
102118
```
103119

104-
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11", "profiling": "12-15"}}
120+
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11", "profiling": "13-23"}}
105121
@import Sentry;
106122

107123
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
@@ -115,16 +131,16 @@ func application(_ application: UIApplication,
115131
options.tracesSampleRate = @1.0;
116132
}];
117133

118-
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
119-
[SentrySDK startProfiler];
134+
// Manually call startProfiler and stopProfiler to profile any code that runs in between.
135+
[SentrySDK startProfiler];
120136

121-
//
122-
// ...anything here will be profiled...
123-
//
137+
//
138+
// ...anything here will be profiled...
139+
//
124140

125-
// Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
126-
// your application until the process exits, the app goes to the background, or stopProfiling is called.
127-
[SentrySDK stopProfiler];
141+
// Calls to stopProfiler are optional - if you don't stop the profiler, it will keep profiling
142+
// your application until the process exits, the app goes to the background, or stopProfiling is called.
143+
[SentrySDK stopProfiler];
128144

129145
return YES;
130146
}
@@ -151,6 +167,66 @@ struct SwiftUIApp: App {
151167
}
152168
}
153169
```
170+
</PlatformSection>
171+
172+
<PlatformSection notSupported={["apple.ios", "apple.macos"]}>
173+
174+
```swift {tabTitle:Swift} {"onboardingOptions": {"performance": "9-12"}}
175+
import Sentry
176+
177+
func application(_ application: UIApplication,
178+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
179+
180+
SentrySDK.start { options in
181+
options.dsn = "___PUBLIC_DSN___"
182+
options.debug = true // Enabled debug when first installing is always helpful
183+
184+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
185+
// We recommend adjusting this value in production.
186+
options.tracesSampleRate = 1.0
187+
}
188+
189+
return true
190+
}
191+
```
192+
193+
```objc {tabTitle:Objective-C} {"onboardingOptions": {"performance": "8-11"}}
194+
@import Sentry;
195+
196+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
197+
198+
[SentrySDK startWithConfigureOptions:^(SentryOptions *options) {
199+
options.dsn = @"___PUBLIC_DSN___";
200+
options.debug = YES; // Enabled debug when first installing is always helpful
201+
202+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
203+
// We recommend adjusting this value in production.
204+
options.tracesSampleRate = @1.0;
205+
}];
206+
207+
return YES;
208+
}
209+
```
210+
211+
```swift {tabTitle:SwiftUI with App conformer} {"onboardingOptions": {"performance": "9-12"}}
212+
import Sentry
213+
214+
@main
215+
struct SwiftUIApp: App {
216+
init() {
217+
SentrySDK.start { options in
218+
options.dsn = "___PUBLIC_DSN___"
219+
options.debug = true // Enabled debug when first installing is always helpful
220+
221+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
222+
// We recommend adjusting this value in production.
223+
options.tracesSampleRate = 1.0
224+
}
225+
}
226+
}
227+
```
228+
229+
</PlatformSection>
154230

155231
## Verify
156232

0 commit comments

Comments
 (0)