-
Notifications
You must be signed in to change notification settings - Fork 23
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
Crash after initialize with pending events: @nonobjc NSData.init(contentsOf:options:) #226
Comments
I would like to add that this occurs within an SDK that is imported into a React Native app, in case that could cause these types of inconsistencies/failures. |
Hi @fandrade-modo - the Are you able to reproduce the issue locally or are you seeing this in a crash reporting tool? |
Hi @crleona, thanks for your response. I noticed the code is wrapped in a Edit: Also, there are some logs where the package is |
Let's try something simple - could you try out this branch? https://github.com/amplitude/Amplitude-Swift/tree/AMP-109858-fix-crash ? otherwise, logs would help, you could you set the log level to debug in your amplitude config? If the new branch is not crashing, I'd still be curious to see if there are any errors thrown on
po error.localizedDescription or any other information you can get about the error would be helpful.
|
Hi @crleona, thanks for your answer. I sent a new version to TestFlight with the log level set to debug and using the version from the branch you sent me, but the crash is still happening. I'm not able to debug because it's happening in production. The stack trace has changed slightly; I'll share it below:
|
Hi @fandrade-modo, the last attempt was just to use a more modern call that would avoid any NSExceptions thrown, as there are rare cases where some of the legacy apis can still throw and are otherwise unrecoverable in Swift. Since we're still erroring out, this is not the case. I'm also unable to reproduce similar crashes on a new react native app including our SDK, so this is may be an issue with your setup, potentially some kind of linking error based off of the call stack. It specifically looks like you are missing the Swift bindings for foundation. If this is the only Swift code in your project, please ensure that the swift standard libraries are actually being linked. |
Hi @crleona, we have the latest version of the Amplitude SDK for React Native and the version of the branch you sent me for iOS. Our entire app is in Swift; we don't have any code or libraries in Objective-C. The error seems to occur when there are pending events, and during the next initialization of the SDK in Swift (which is initialized after the RN one), it causes the crash. |
OK, that means that you are effectively loading 2 different versions of our SDK in the same app - React native also bundles a copy of the this SDK via cocoapods. This is not a supported configuration, especially pointing to the same api key / instance name. Please convert your code to only use one, and we can continue to take a look if the issues persist, or reach out to your support representative. |
The application is crashing after initializing Amplitude. This seems to happen when there are pending events from a previous session that have not yet been sent. Below is the stack trace of the error:
The text was updated successfully, but these errors were encountered: