braintree / braintree_ios

Braintree SDK for iOS
https://developer.paypal.com/braintree/docs/start/hello-client/ios/v5
MIT License
560 stars 294 forks source link

App Crash on Launch After Upgrading Braintree SDK from 5.2 to 6.23.2 #1396

Closed Navdeep2020 closed 1 month ago

Navdeep2020 commented 2 months ago

Braintree SDK Version

6.23.2

Environment

Both

Xcode Version

15.4

OS Version & Device

ios 16

Integration type

CocoaPods

Development Processor

Apple Silicon (M-series chips)

Describe the bug

I recently updated the Braintree SDK in my iOS project from version 5.21 to 6.23.2. After making the necessary changes in the Podfile, AppDelegate, and other integration points, the application worked fine during the initial testing.

However, after integrating the SDK into our Customer Portal (CP) and completing all required updates (including pod updates and version upgrades), the app crashes on the launch screen.

Error in console is:

 Symbol not found: _$s9Braintree13BTVenmoClientC018openVenmoAppPageInF5StoreyyFTj
  Referenced from: <553D15F4-0932-3EB9-8BA8-34A35971E393> /Users/navsingh/Library/Developer/Xcode/DerivedData/CustomerPortal-hfezrjyacftxxcfidrmywzpmjvgp/Build/Products/Debug-iphonesimulator/Paymentus.framework/Paymentus
  Expected in:     <FFA24E47-75B1-35FA-950D-D83B2BA55116> /Users/navsingh/Library/Developer/CoreSimulator/Devices/54C458E7-E7ED-4D1E-8622-DD15A28DAABA/data/Containers/Bundle/Application/70C6D875-14AF-477C-BE96-BA567043EE66/Customer Portal.app/Frameworks/Braintree.framework/Braintree

To reproduce

Steps to Reproduce:

  1. Update the Braintree SDK from 5.2 to 6.23.2.
  2. Make necessary changes in Podfile, AppDelegate, etc.
  3. Integrate the SDK into a any project
  4. Perform pod updates and version upgrades.
  5. Launch the app.

Expected behavior

The app should not crash. Bit confused that line 28 is correct or not.

image

Screenshots

No response

KunJeongPark commented 2 months ago

Hello, there is a known issue with 6.23.2 which was addressed in 6.23.3 Please upgrade to our latest version. We apologize for the inconvenience.

Navdeep2020 commented 2 months ago

@KunJeongPark I have upgraded to 6.23.3 but the error is still same at run time, Please look at the issue more carefully.

image
nrajput05 commented 2 months ago

Getting the same issue. The error states that it can not find BTVenmoClient, see the error below:

Symbol not found: _$s9Braintree13BTVenmoClientC018openVenmoAppPageInF5StoreyyFTj Referenced from: <2B225D39-25E0-3718-A3E1-A2EBE0B88B67> /Users/xyz/Library/Developer/Xcode/DerivedData/CustomerPortal-bjcrubavwaoeufgtdntitbgnmgae/Build/Products/Debug-iphonesimulator/Payin.framework/Payin Expected in: <FE2F0A00-1848-377C-A648-CC9B2871C27D> /Users/xyz/Library/Developer/CoreSimulator/Devices/D8A27BCA-7988-4634-A049-D08D641675AA/data/Containers/Bundle/Application/F64561D8-30E5-46C2-B76C-DBC9D8F31FE7/Customer Portal.app/Frameworks/Braintree.framework/Braintree

I have an xcframework which uses Braintree as a dependency/cocoapods. The app is responsible to provide the pod to my framework. But after migration to 6.23.3 I am getting the above issue.

Also note that when I migrated, all the BTVenmoDriver class names were replaced by BTVenmoClient which is the exact name being printed in the console.

Please assist at the earliest !

himandhawan001 commented 2 months ago

+1, found the same issue at my side too and it is blocking my current release @KunJeongPark can you create new framework project and add braintree dependencies and add the framework in new application with same dependencies through cocoa pods. You will get the crash.

himandhawan001 commented 2 months ago

Below code contains the error @KunJeongPark Steps :

  1. Build TestingBraintreeFramework project and copy the .framework file from Products
  2. Add framework to TestingBraintree Project.
  3. Run the code Now Uncomment the req.vault = false at line number 36 in TestBraintree file and again repeat same steps. The crash will resolve.

Github Issue.zip

KunJeongPark commented 2 months ago

Thank you for the further information. First thing I want to do is make sure that these are not different issues. Addressing @Navdeep2020 's first message, it seems like some issue with some symbol not being found.

For @himandhawan001 and @nrajput05, if it's not the same issue, if we have more information regarding which version worked for you, and which one you are having trouble with now, it would help us identify the issue. And also which Xcode version, iOS version you are testing with. There have been a lot of updates between 5.2 => 6.23.2 reported by Navdeep, so I am trying to figure out which change, from which version is causing this issue by getting that info from both of you.

I think it might be related to our switch to static version of the data collector in Braintree SDK version 5.8. . Looking at @himandhawan001 's project, both the framework and the app have same Braintree SDK dependencies. Since data collector is now linked statically, this could be causing a conflict.

We will investigate this more thoroughly next week. We are back to work hours next Tuesday and we will investigate the issue. Thank you for your patience.

Navdeep2020 commented 1 month ago

@KunJeongPark To address your questions:

  1. All three issues are indeed the same.
  2. The problem began after updating the Braintree SDK in our iOS project from version 5.21.0 to 6.23.3.
  3. Versions where the issue didn't occurred: 5.21.0
  4. Versions where the issue occurred: 6.23.2, 6.23.3, 6.20.0.
  5. Xcode version used: 15.4.
KunJeongPark commented 1 month ago

I was not able to recreate this issue with Xcode 15.3 I will try to test with Xcode 15.4 and Xcode 15.2 as soon as I can.

Steps I took using our SDK version 6.23.3 and Xcode 15.3:

  1. Create framework with Braintree, Braintree/Venmo and Braintree/DataCollector dependencies
  2. Create an Xcode app workspace using same dependencies and importing the framework
  3. Try with and without default values set for request objects as mentioned in @himandhawan001 's sample project
  4. Try with UIKit and SwiftUI app to rule out issues with Object-C interoperability issue.

Note: I used pod install with Podfiles to manage dependencies. Have you tried to clean the build folder and reinstalling the pods?

Navdeep2020 commented 1 month ago

@KunJeongPark I have already tried reinstalling the pods and cleaning the build folder, but the issue persists. I have tested the project on Xcode 15.3, and the problem still occurs on my end. It would be great if you could try running my demo project as well, which is quite small and easy to set up. This way, you can reproduce the issue on your machine.

Additionally, we are seeing the same error when using PayPal (without Venmo), specifically when accessing BTPayPalVaultRequest. The issue occurs if the following line is included: req.offerCredit = true

When we comment this line, the project works fine.

The overall error that we get in the console is

dyld[58658]: Symbol not found: _$s9Braintree24BTPayPalVaultBaseRequestC11offerCreditSbvsTj
  Referenced from: <30AAA43D-16D7-31B2-AB8A-9878BC91C355> /Users/xyz/Library/Developer/CoreSimulator/Devices/51135919-7D72-4FE7-9CF9-3740E1D79569/data/Containers/Bundle/Application/5FE89493-5227-4882-886F-2A299DDF6206/xc15testApp.app/Frameworks/xc15testframework.framework/xc15testframework
  Expected in:     <7C87D6B3-3E20-33A4-BA7A-54AE843AC03F> /Users/xyz/Library/Developer/CoreSimulator/Devices/51135919-7D72-4FE7-9CF9-3740E1D79569/data/Containers/Bundle/Application/5FE89493-5227-4882-886F-2A299DDF6206/xc15testApp.app/Frameworks/Braintree.framework/Braintree

Archive.zip

KunJeongPark commented 1 month ago

@Navdeep2020 Thank you for providing me with the project. I do see the crash with your projects but I am not able to recreate it with project I am building in a similar manner. I am comparing settings, etc.

So just to clarify, you had this same issue with our SDK 6.20.0, 6.23.2, 6.23.3 and last working version for your application was 5.2 as mentioned in the original post? or 5.21 as mentioned in more recent post?

I will continue to investigate this with my team next week.

Navdeep2020 commented 1 month ago

Hi @KunJeongPark 5.21 was the last working version for us. We shifted from 5.21 to 6.23.2,6.23.3(all non-working versions) etc

KunJeongPark commented 1 month ago

We were able to successfully compile your app by adding these lines in the Podfile of your app project.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
  end
end

There must be something different about how we built our frameworks because I couldn't recreate the crash on my end building project similar to yours. But the above lines fixed your sample project so it doesn't crash.

jaxdesmarais commented 1 month ago

Hey all -

Just checking to see if the solution @KunJeongPark provided resolved the issue you all were seeing.

Navdeep2020 commented 1 month ago

Yes, it worked, @KunJeongPark . However, our SDK, which includes Braintree 6.23.2, is used by company billers, meaning all billers would need to update their pod files on the app side. Could you implement this change on your end to prevent each biller from having to do it manually?

jaxdesmarais commented 1 month ago

Hey @Navdeep2020 -

You should be able to set this up in the framework you are building that wraps the Braintree SDK. On the SDK side we are setting this value to true, but since you are building a framework that wraps the Braintree SDK you'd need to set it at that level as well. You may find this cocoapods GitHub issue helpful as it lists some solutions for building frameworks with dependencies with this flag.