Skip to content

fix: Return success during Cocoa SDK init on macOS #2104

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

Merged
merged 2 commits into from
Apr 15, 2025
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixes

- When targeting macOS, the SDK no longer fails to sync the scope to native events ([#2104](https://github.com/getsentry/sentry-unity/pull/2104))

### Features

- The SDK now reports the game's name as part of the app context ([2083](https://github.com/getsentry/sentry-unity/pull/2083))
Expand Down
12 changes: 10 additions & 2 deletions package-dev/Plugins/macOS/SentryNativeBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,22 @@ void SentryNativeBridgeOptionsSetInt(const void *options, const char *name, int3
dictOptions[[NSString stringWithUTF8String:name]] = [NSNumber numberWithInt:value];
}

void SentryNativeBridgeStartWithOptions(const void *options)
int SentryNativeBridgeStartWithOptions(const void *options)
{
NSMutableDictionary *dictOptions = (__bridge_transfer NSMutableDictionary *)options;
NSError *error = nil;

id sentryOptions = [[SentryOptions alloc]
performSelector:@selector(initWithDict:didFailWithError:)
withObject:dictOptions withObject:nil];
withObject:dictOptions withObject:&error];

if (error != nil)
{
return 0;
}

[SentrySDK performSelector:@selector(startWithOptions:) withObject:sentryOptions];
return 1;
}

void SentryConfigureScope(void (^callback)(id))
Expand Down