From 11a095f6f87510192932ffaca8e192c480104cb7 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 6 Aug 2024 14:49:26 +0200 Subject: [PATCH 1/4] feat(apple): Add docs for swizzleClassNameExcludes Add docs for the existing option swizzleClassNameExcludes. --- .../apple/common/configuration/swizzling.mdx | 27 +++++++++++++++++++ .../automatic-instrumentation.mdx | 21 +++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/docs/platforms/apple/common/configuration/swizzling.mdx b/docs/platforms/apple/common/configuration/swizzling.mdx index 45d3b298d399e..c861d513d4b05 100644 --- a/docs/platforms/apple/common/configuration/swizzling.mdx +++ b/docs/platforms/apple/common/configuration/swizzling.mdx @@ -47,3 +47,30 @@ SentrySDK.start { options in options.enableSwizzling = NO; }]; ``` + + +## Skip Swizzling for Specific Classes + +To skip swizzling 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 class name of a class to swizzle contains a class name of 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 +SentrySDK.start { options in + options.swizzleClassNameExcludes = [ + "MyUIViewController", + ] +} +``` + +```objc {tabTitle:Objective-C} +[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 3623fec2082b6..6de313e5f8003 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -58,8 +58,29 @@ SentrySDK.start { options in }]; ``` +You can disable UIViewController tracing for specific UIViewControllers by using the option `swizzleClassNameExcludes`: + + +```swift +SentrySDK.start { options in + options.swizzleClassNameExcludes = [ + "MyUIViewController", + ] +} +``` + +```objc {tabTitle:Objective-C} +[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. From e5668b32f3206b9dbf2be1af34ca23274e1fad54 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Tue, 6 Aug 2024 14:51:20 +0200 Subject: [PATCH 2/4] feat(apple): Add docs for swizzleClassNameExcludes Add docs for the existing option swizzleClassNameExcludes. --- .../apple/common/configuration/swizzling.mdx | 12 ++++++++---- .../instrumentation/automatic-instrumentation.mdx | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/platforms/apple/common/configuration/swizzling.mdx b/docs/platforms/apple/common/configuration/swizzling.mdx index c861d513d4b05..6db5a1e01eff8 100644 --- a/docs/platforms/apple/common/configuration/swizzling.mdx +++ b/docs/platforms/apple/common/configuration/swizzling.mdx @@ -53,12 +53,14 @@ SentrySDK.start { options in To skip swizzling 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 class name of a class to swizzle contains a class name of 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 +- `YourApp.MyUIViewController` +- `YourApp.MyUIViewControllerA` +- `MyApp.MyUIViewController` -```swift +```swift {tabTitle:Swift} +import Sentry + SentrySDK.start { options in options.swizzleClassNameExcludes = [ "MyUIViewController", @@ -67,6 +69,8 @@ SentrySDK.start { options in ``` ```objc {tabTitle:Objective-C} +@import Sentry; + [SentrySDK startWithConfigureOptions:^(SentryOptions *options) { options.swizzleClassNameExcludes = [NSSet setWithObjects: @"MyUIViewController", diff --git a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx index 6de313e5f8003..1ceda316e6876 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -61,7 +61,9 @@ SentrySDK.start { options in You can disable UIViewController tracing for specific UIViewControllers by using the option `swizzleClassNameExcludes`: -```swift +```swift {tabTitle:Swift} +import Sentry + SentrySDK.start { options in options.swizzleClassNameExcludes = [ "MyUIViewController", @@ -70,6 +72,8 @@ SentrySDK.start { options in ``` ```objc {tabTitle:Objective-C} +@import Sentry; + [SentrySDK startWithConfigureOptions:^(SentryOptions *options) { options.swizzleClassNameExcludes = [NSSet setWithObjects: @"MyUIViewController", From 366e4026576afa806344085b738aa7e01ff86226 Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 7 Aug 2024 08:20:43 +0200 Subject: [PATCH 3/4] Update docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx Co-authored-by: Karl Heinz Struggl --- .../tracing/instrumentation/automatic-instrumentation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx index 1ceda316e6876..2103b8d7bbade 100644 --- a/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx +++ b/docs/platforms/apple/common/tracing/instrumentation/automatic-instrumentation.mdx @@ -58,7 +58,7 @@ SentrySDK.start { options in }]; ``` -You can disable UIViewController tracing for specific UIViewControllers by using the option `swizzleClassNameExcludes`: +You can deactivate tracing for specific UIViewControllers by configuring `swizzleClassNameExcludes`: ```swift {tabTitle:Swift} From 963616d4b92cf147055834ffdc89042833f5ee4b Mon Sep 17 00:00:00 2001 From: Philipp Hofmann Date: Wed, 7 Aug 2024 08:20:49 +0200 Subject: [PATCH 4/4] Update docs/platforms/apple/common/configuration/swizzling.mdx Co-authored-by: Karl Heinz Struggl --- docs/platforms/apple/common/configuration/swizzling.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/apple/common/configuration/swizzling.mdx b/docs/platforms/apple/common/configuration/swizzling.mdx index 6db5a1e01eff8..8468249eadffa 100644 --- a/docs/platforms/apple/common/configuration/swizzling.mdx +++ b/docs/platforms/apple/common/configuration/swizzling.mdx @@ -49,9 +49,9 @@ SentrySDK.start { options in ``` -## Skip Swizzling for Specific Classes +## Deactivate Swizzling for Specific Classes -To skip swizzling 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 class name of a class to swizzle contains a class name of this option. For example, if you add MyUIViewController to this list, the Sentry Cocoa SDK excludes the following classes from swizzling: +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`