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 2 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;
}];
```


## 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:
philipphofmann marked this conversation as resolved.
Show resolved Hide resolved

- `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 disable UIViewController tracing for specific UIViewControllers by using the option <PlatformLink to="/configuration/swizzling#skip-swizzling-for-specific-classes">`swizzleClassNameExcludes`</PlatformLink>:
philipphofmann marked this conversation as resolved.
Show resolved Hide resolved


```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