Skip to content

Commit 1ab0a59

Browse files
authored
fix: Disable Watchdog on iOS to prevent false positive reports (#2403)
1 parent ca5e952 commit 1ab0a59

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Fixes
1111

12+
- When targeting iOS, the `WatchdogTerminationIntegration` now defaults to `false` as to not report false positives. Users can control this through the option `IosWatchdogTerminationIntegrationEnabled` ([#2403](https://github.com/getsentry/sentry-unity/pull/2403))
1213
- The SDK now correctly sets the currently active scene's name on the event ([#2400](https://github.com/getsentry/sentry-unity/pull/2400))
1314
- Fixed an issue where screenshot capture triggered on a burst job would crash the game. The SDK can now also capture screenshots on events that occur outside of the main thread ([#2392](https://github.com/getsentry/sentry-unity/pull/2392))
1415
- Structured logs now have the `origin` and `sdk` attributes correctly set ([#2390](https://github.com/getsentry/sentry-unity/pull/2390))

src/Sentry.Unity.Editor.iOS/NativeOptions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ internal static string Generate(SentryUnityOptions options)
3737
@""attachScreenshot"" : @{ToObjCString(options.AttachScreenshot)},
3838
@""release"" : @""{options.Release}"",
3939
@""environment"" : @""{options.Environment}"",
40-
@""enableNetworkBreadcrumbs"" : @NO
40+
@""enableNetworkBreadcrumbs"" : @NO,
41+
@""enableWatchdogTerminationTracking"" : @{ToObjCString(options.IosWatchdogTerminationIntegrationEnabled)},
4142
}};
4243
4344
NSError *error = nil;

src/Sentry.Unity.iOS/SentryCocoaBridgeProxy.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ public static bool Init(SentryUnityOptions options)
6060
options.DiagnosticLogger?.LogDebug("Setting MaxCacheItems: {0}", options.MaxCacheItems);
6161
OptionsSetInt(cOptions, "maxCacheItems", options.MaxCacheItems);
6262

63+
// See https://github.com/getsentry/sentry-unity/issues/1658
64+
OptionsSetInt(cOptions, "enableNetworkBreadcrumbs", 0);
65+
66+
options.DiagnosticLogger?.LogDebug("Setting EnableWatchdogTerminationTracking: {0}", options.IosWatchdogTerminationIntegrationEnabled);
67+
OptionsSetInt(cOptions, "enableWatchdogTerminationTracking", options.IosWatchdogTerminationIntegrationEnabled ? 1 : 0);
68+
6369
var result = StartWithOptions(cOptions);
6470
return result is 1;
6571
}

src/Sentry.Unity/SentryUnityOptions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ public sealed class SentryUnityOptions : SentryOptions
166166
/// </summary>
167167
public bool IosNativeSupportEnabled { get; set; } = true;
168168

169+
/// <summary>
170+
/// Whether the SDK should add native support for iOS
171+
/// </summary>
172+
public bool IosWatchdogTerminationIntegrationEnabled { get; set; } = false;
173+
169174
/// <summary>
170175
/// Whether the SDK should initialize the native SDK before the game starts. This bakes the options at build-time into
171176
/// the generated Xcode project. Modifying the options at runtime will not affect the options used to initialize

0 commit comments

Comments
 (0)