braintree / braintree_ios

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

Support for building on Apple Silicon Simulators #564

Closed JonathanDowning closed 2 years ago

JonathanDowning commented 3 years ago

Integration Details (please complete the following information):

Describe the bug When using Braintree integrated with Swift Package Manager, on an Apple Silicon Mac, I am unable to compile the framework due to MagnesSDK being incompatible with this configuration.

To Reproduce Steps to reproduce the behavior: Compile a project utilizing the Braintree 5.0.0-beta SDK using an Apple Silicon Mac

Expected behavior A successful build of the project

Screenshots

Screen Shot 2020-12-18 at 05 34 06
scannillo commented 3 years ago

Hello @JonathanDowning - we don't currently have an Apple Silicon Mac to replicate this on to troubleshoot, however we will reach out to our Magnes SDK team about this issue.

Just to confirm that you have the Braintree modules properly included via SPM, can you confirm which Braintree modules you have in your project settings under General > Frameworks, Libraries, and Embedded Content (and that they are each set to Embed & Sign)?

JonathanDowning commented 3 years ago

Hey @scannillo and Happy New Year!

I've been playing around with this issue this morning and here are some observations:

  1. The project is using braintree-ios version 5.0.0-beta1
  2. BraintreePayPal and PayPalDataCollector have been added to the project's Frameworks, Libraries, and Embedded Content
  3. The project successfully builds for Any iOS Device (arm64)
  4. The project successfully builds for iOS 13 and iOS 12 simulators
  5. The project fails to build for iOS 14 simulators, emitting the following error: Cannot find 'MagnesSDK' in scope

Thoughts: I suspect MagnesSDK need to be built with an architecture slice appropriate for iOS Simulators running natively in Apple Silicon mode. iOS 12 and 13 simulators currently run in Rosetta mode which may explain why these don't emit the error, whereas iOS 14 sims do.

Having inspected another of our dependencies, Firebase for iOS, their binary dependencies do not exhibit this issue, I discovered their xcframeworks have an arm64 slice in the simulator variants. It appears PPRiskMagnes.xcframework is missing this arm64 slice and thus cannot compile for arm64 (Apple Silicon) simulators.

Screen Shot 2021-01-04 at 07 18 05
sestevens commented 3 years ago

Hi @JonathanDowning, thanks for providing all of this detail! I just opened a PR updating to a newer version of the Magnes SDK that includes an arm64 simulator slice. We'll post an update to this issue when this change is released. Feel free to check out the PR branch if you like!

JonathanDowning commented 3 years ago

@sestevens thank you for the prompt response, I've tested it and I can now use iOS 14 simulators on Apple Silicon, yay!

sestevens commented 3 years ago

@JonathanDowning Awesome, thanks for letting us know! 👏

sestevens commented 3 years ago

This change has been released in 5.0.0-beta2.

ejensen commented 3 years ago

The same issue with not being able to use the iOS 14 simulators still occurs with the KountDataCollector and CardinalMobile frameworks

Screen Shot 2021-01-26 at 12 23 50 PM
scannillo commented 3 years ago

👋 Hi @ejensen. That looks like a different issue than the one being reported in this thread. In your build settings, can you set Excluded Architectures to add Any iOS Simulator SDK with a value of arm64 for both Debug and Release mode (see related issue)? If you would like to follow up about this - please open a new GitHub issue.

There have also already been similar GitHub issues.

ejensen commented 3 years ago

@scannillo excluding the arm64 architecture won't fix this issue where the iOS 14 simulator on Apple Silicon requires the arm64 architecture slice that KountDataCollector and CardinalMobile don't provide. The error in my previous post's screenshot shows that Xcode is finding the Simulator-x86_64 architecture in those frameworks and not the arm64 slice it needs to run.

Similar to the screenshot @JonathanDowning posted above, KountDataCollector and CardinalMobile don't have the arch64 slice which is now included in the 5.10.0 PPRiskMagnes framework. archs

The simulators won't run the Simulator-x86_64 code unless it's forced to run with Rosetta 2 (workaround mentioned above is to use the iOS 13 simulator) I'm hoping the arm64 can be included in the KountDataCollector and CardinalMobile frameworks so we can use the iOS 14 simulator on Apple Silicon

scannillo commented 3 years ago

Ok - thank you for the additional detail @ejensen. This makes sense, and we are going to reach out to our partners at CardinalMobile and Kount ASAP.

Can you confirm though that you're able to build OK on a real device?

ejensen commented 3 years ago

@scannillo Thanks! Yes, I'm able to run on a real device. This issue only surfaces on the Simulator

sestevens commented 3 years ago

This has been fixed for PPRiskMagnes and KountDataCollector in version 5.0.0. We're waiting for a fix for CardinalMobile, so we'll leave this issue open for now.

Please see our migration guide for steps to upgrade your integration.

JackoPlane commented 3 years ago

Hi @sestevens, Do you have any sort of timeline for supporting M1 macs with CardinalMobile ?

scannillo commented 3 years ago

Hi @JackoPlane - our Fraud Tools team is regularly bringing up this request with CardinalMobile, however they haven't given us information about arm64 support yet. We will keep you posted as soon as we have more information and will continue to raise this as a pressing issue to them.

alexito4 commented 3 years ago

@scannillo do you have any update on this? Currently this is the only library that is blocking us in M1 which is causing trouble in our development team.

lordukr commented 3 years ago

Hey Braintree team, any updates regarding this?

scannillo commented 3 years ago

Hi everyone - thank you for your activity on this issue. We want to get this resolved as quickly as possible, but are still blocked by our MPI (3DS) provider CardinalMobile. We are actively communicating this concern to them on a weekly basis but they still haven't given us an ETA. We will keep pushing on this as much as we can, and keep you posted.

alexito4 commented 3 years ago

@scannillo if you need more arguments to push for: be aware that it seems that current workarounds won't work anymore https://developer.apple.com/forums/thread/681749 so this will literally block all your customers pretty soon.

lordukr commented 3 years ago

@scannillo any news?

scannillo commented 3 years ago

@lordukr - no news, unfortunately. Will keep on it and keep you posted.

bofeizhu commented 3 years ago

@scannillo It has been 7 months since this issue was opened. Maybe it's time for your team to switch to another provider that can offer more reliable support.

scannillo commented 3 years ago

@scannillo It has been 7 months since this issue was opened. Maybe it's time for your team to switch to another provider that can offer more reliable support.

Hi @bofeizhu. I agree in that this current lack of support from CardinalMobile is unacceptable. My team and I are actively and frequently communicating these concerns to our leaders. In the meantime, we will continue to prod Cardinal for this update.

Onno113 commented 3 years ago

Hello, I am just writing to mention that this is also problem for the company I am working for (FREE NOW) because we have the first computer for CI/CD with Apple Silicon architecture. The Braintree SDK is the only reason we cannot use it, it seems.

dweiner13 commented 3 years ago

Hi @scannillo — I know you are aware of this problem and that it's not trivial to solve. I just want to add that this is a problem at our company as well, and ask if there's any plans to move forward here?

Considering Apple's tight schedule for transitioning all their laptops to Apple Silicon, it'll only be a matter of months until Apple is no longer manufacturing a computer that can compile Braintree for the Simulator. Building to a physical device is a workaround, but not a very feasible one, especially as devs adopt SwiftUI, which relies on the Simulator for its live previews.

JackoPlane commented 3 years ago

Echoing @dweiner13 comments,

@scannillo Could we have an update on where things are at and how the community can assist in applying pressure to get support for Apple Silicon? Is this something we should be brining up with our account manager?

scannillo commented 3 years ago

@scannillo Could we have an update on where things are at and how the community can assist in applying pressure to get support for Apple Silicon? Is this something we should be brining up with our account manager?

Hi everyone. Cardinal has still given us no update. We are applying as much pressure as we can on this.

It would definitely help if you raise this concern to your account manager! Thank you!

DagAgren commented 3 years ago

@scannillo The rumours are that running the simulator under Rosetta no longer works on macOS 12, which would block all development of any app that uses Cardinal. So this is getting quite urgent to fix, as macOS 12 is coming fairly soon.

See for instance https://developer.apple.com/forums/thread/681749.

skywalkerlw commented 3 years ago

Can not wait !!!

alexjameslittle commented 3 years ago

We at Depop are also blocked by this issue

scannillo commented 3 years ago

Hi everyone. Just an update for you all - we've been consistently raising this issue to Cardinal, and they have given us an ETA of making this update in late October. We will do everything we can to push that they deliver on this timeframe estimate.

timonchev commented 2 years ago

Hey, any updates?

scannillo commented 2 years ago

CardinalMobile delayed their delivery date for this by another week, unfortunately 🙃. We are consistently pushing for updates on this delivery. I have high hopes it will happen soon!

thedrick commented 2 years ago

We really appreciate the updates @scannillo - a large number of us are waiting on this, so any info you have is amazing 🙏 Thank you so much for pushing on this issue for everyone

shepting commented 2 years ago

@scannillo It looks like CardinalMobile had a release on October 26th with ARM support built in: https://cardinaldocs.atlassian.net/wiki/spaces/CMSDK/pages/2828206081/New+Release+Cardinal+Mobile+SDK+2.2.5-2+iOS

scannillo commented 2 years ago

Hi @shepting - we have this PR open adding support for M1 👏 . Will keep this thread posted when we cut the release. Should be soon, assuming our CI & testing succeeds as expected.

scannillo commented 2 years ago

Hello everyone - Braintree iOS v5.5.0 is released. It allows all SPM, CocoaPods, and Carthage users on xcframeworks to get Apple Silicon simulator support.

Please see the release notes for the caveat for Carthage users on frameworks. Another Cardinal bug caused this limitation, but most of you should be unblocked.

Please leave feedback if the SDK works as expected for you!

bofeizhu commented 2 years ago

@scannillo Could you release BraintreeDropIn for arm64-sim as well (drop excluded archs)

scannillo commented 2 years ago

Hi @bofeizhu - definitely. It is in PR now (https://github.com/braintree/braintree-ios-drop-in/pull/357). Once it's approved internally, we'll get a release out ASAP. But in the meantime feel free to use that branch arm-64-support if you want.

scannillo commented 2 years ago

I am going to close this issue now that v5.5.0 is released with arm64 support 👏 . Feel free to open a new issue if any issues arise! Thank you all for your patience and for commenting on this thread, it helps us a ton!