diff --git a/docs/platforms/apple/common/configuration/swizzling.mdx b/docs/platforms/apple/common/configuration/swizzling.mdx index 45d3b298d399e..8468249eadffa 100644 --- a/docs/platforms/apple/common/configuration/swizzling.mdx +++ b/docs/platforms/apple/common/configuration/swizzling.mdx @@ -47,3 +47,34 @@ SentrySDK.start { options in options.enableSwizzling = NO; }]; ``` + + +## Deactivate Swizzling for Specific Classes + +To deactivate swizzling for specific classes, you can use the option `swizzleClassNameExcludes`, which is available with Sentry Cocoa SDK version `8.23.0` and above. The SDK checks if the name of a class it intends to swizzle contains any class name configured using this option. For example, if you add `MyUIViewController` to this list, the Sentry Cocoa SDK excludes the following classes from swizzling: + +- `YourApp.MyUIViewController` +- `YourApp.MyUIViewControllerA` +- `MyApp.MyUIViewController` + + +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.swizzleClassNameExcludes = [ + "MyUIViewController", + ] +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.swizzleClassNameExcludes = [NSSet setWithObjects: + @"MyUIViewController", + nil + ]; +}]; +``` diff --git a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx index b18262c58b342..d291b00213ed9 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -58,8 +58,33 @@ SentrySDK.start { options in }]; ``` +You can deactivate tracing for specific UIViewControllers by configuring `swizzleClassNameExcludes`: + + +```swift {tabTitle:Swift} +import Sentry + +SentrySDK.start { options in + options.swizzleClassNameExcludes = [ + "MyUIViewController", + ] +} +``` + +```objc {tabTitle:Objective-C} +@import Sentry; + +[SentrySDK startWithConfigureOptions:^(SentryOptions *options) { + options.swizzleClassNameExcludes = [NSSet setWithObjects: + @"MyUIViewController", + nil + ]; +}]; +``` + [UIViewController]: https://developer.apple.com/documentation/uikit/uiviewcontroller + ## App Start Tracing This feature is available for iOS, tvOS, and Mac Catalyst.