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

react-native: fix invalid RN object returned from iOS BacktraceReactNative.initialize function #308

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

perf2711
Copy link
Contributor

@perf2711 perf2711 commented Oct 23, 2024

This PR returns nil instead of instance from BacktraceReactNative.initialize, as the instance object was impossible to serialize to JSON.

https://reactnative.dev/docs/0.70/native-modules-ios#synchronous-methods

The return type of this method must be of object type (id) and should be serializable to JSON. This means that the hook can only return nil or JSON values (e.g. NSNumber, NSString, NSArray, NSDictionary).

@perf2711 perf2711 added the bug Something isn't working label Oct 23, 2024
@perf2711 perf2711 requested a review from konraddysput October 23, 2024 10:51
@perf2711 perf2711 self-assigned this Oct 23, 2024
@@ -15,7 +15,7 @@ @implementation BacktraceReactNative
}
instance = [[BacktraceCrashReporter alloc] initWithBacktraceUrl:submissionUrl andDatabasePath: databasePath andAttributes: attributes andOomSupport:TRUE andAttachments:attachmentPaths];
[instance start];
return instance;
return nil;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to return something from the function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, the return value is not used at all.

@perf2711 perf2711 merged commit dbbe41e into main Oct 24, 2024
5 checks passed
@perf2711 perf2711 deleted the bugfix/react-native-ios-initialize-invalid-obj branch October 24, 2024 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants