-
Notifications
You must be signed in to change notification settings - Fork 514
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
iOS binding library - Crash when app launches #21546
Comments
This is interesting, I can reproduce the crash. It happens very early on, when we load the Objective-C types we know about, in fact it's our own generated Objective-C code that crashes, something equivalent handle = [_TtC13BraintreeCore20BTPaymentMethodNonce class]; Would you happen to know if there's an Xcode sample project somewhere that exercises the Objective-C version of the API you want to bind? |
@rolfbjarne - Thanks for investigating this! I searched for a sample project that uses the Objective-C APIs, but I didn't find anything. I also asked the Braintree team about it. They don't have an Objective-C sample, but do say the SDK is compatible with Objective-C. See braintree/braintree_ios#1450 (comment) Are there any other options to isolate/debug the problem? Thanks again! |
I'll have a look next week and see what I can figure out. |
I've figured out the problem, and a fix is in progress. In the meantime, you can add this to your csproj as a workaround: <PropertyGroup>
<Registrar>dynamic</Registrar>
</PropertyGroup> |
The problem is that the classes causing problems are stub classes, and we don't handle stub classes correctly (we've never run into them before): |
@rolfbjarne -- Thank you! With your workaround, the startup crash is gone and I can access the Braintree APIs from my iOS app. I appreciate your help with this and I'm looking forward to the full fix. Thanks again! |
Apple platform
iOS
Framework version
net8.0-*
Affected platform version
JetBrains Rider 2024.2.7, .NET workload ios 18.0.8303/8.0.100, Xcode 16.0, iPhone 11 Pro iOS 17.7
Description
I'm trying to bind Braintree SDK for iOS v6.23.3.
The binding and app build successfully, but the app crashes at the launch screen. I'm testing on a physical device (iPhone 11 Pro, iOS 17.7). I haven't tried it in the simulator.
This repo demonstrates the problem. Build logs attached. Console log of the crash attached.
The crash is related to particular Braintree APIs. When I exclude the problematic APIs, the app launches successfully. I've added four "#define STARTUP_CRASH..." statements to the top of ApiDefinitions to isolate the problematic APIs. If I comment out all four of those "#define" statements, the app launches successfully. But if one or more are uncommented, the app will crash at launch.
The problematic APIs all relate to the BTPaymentMethodNonce type within BraintreeCore.xcframework. They either inherit from that type or utilize a descendent of that type.
Also, I see this warning in the build:
warning MT7091: The framework PPRiskMagnes.framework is a framework of static libraries, and will not be copied to the app.
If I change the NativeReference for that framework to "Static", I get a linker error during the build.
Any advice/insight is appreciated. Thanks.
Steps to Reproduce
Did you find any workaround?
No workaround.
Build logs
MSBuild_Log_Startup_Crash_241029.zip
Console_Log_Startup_Crash_241029.txt
The text was updated successfully, but these errors were encountered: