Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apple): Add docs for swizzleClassNameExcludes #10992

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/platforms/apple/common/configuration/swizzling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
];
}];
```
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,33 @@ SentrySDK.start { options in
}];
```

You can deactivate tracing for specific UIViewControllers by configuring <PlatformLink to="/configuration/swizzling#skip-swizzling-for-specific-classes">`swizzleClassNameExcludes`</PlatformLink>:


```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.
Expand Down
Loading