braintree_ios: Archive failure No such module 'PPRiskMagnes'
Integration Details (please complete the following information):
- Braintree SDK Version: 5.3.1
- Environment: N/A
- iOS Version: iOS 14.5 SDK
- Device: arm64 devices
- Integration type & version: Swift Package Manager 5.4.0
Describe the bug
Archiving fails when importing a subset of libraries within the Braintree Swift Package. The PayPalDataCollector library fails to compile: No such module 'PPRiskMagnes'
This was not an issue in Braintree 5.3.0 and earlier.
To Reproduce Steps to reproduce the behavior (video attached below):
- Open the SPMTest app project
- Remove a reference of the optional Braintree libraries (ex. Union Pay, Venmo, etc)
- Set the archive build configuration to “Debug”
- Perform a clean archive
Expected behavior The archive completes successfully
Screenshots

https://user-images.githubusercontent.com/915431/118695280-de3c5880-b7c1-11eb-89cc-67dae7d06862.mp4
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 42 (12 by maintainers)
This seems to be a bug in the Xcode build system for swiftPM integration! Try this https://github.com/simonpierreroy/xcframework-issue and always clean in between it should fail! It does the same with my own local package that has an XCframework! Here is my feedback
FB9125479. I used this repo for my feedback to apple, since I was having the same issues with a close source package I can not share.I spent time in an Xcode lab during WWDC. They fully acknowledged the bug and will be working on it, although there’s no indication as to when it will be fixed (hopefully they’ll do an Xcode 12.5.1!).
In the meantime, they offered this workaround, which I have not had a chance to try yet. The failure is caused by a clean build failing to properly process XCFrameworks. This processing step involves copying them to the correct location in the built products directory. The proposed workaround is to manually copy the binary XCFrameworks to the appropriate location in the build products directory. This might work as a Run Script build phase in the main target, or you might need to create a separate Aggregate target and make that a dependency of the target you’re trying to build.
The correct location can be found by doing one of the target builds that works and looking for where it copies
PPRiskMagnes. Unfortunately I can’t take the time right now to figure that out.While we wait for an update to SPM, Is there an older version of the Braintree SDK that can be used with SPM that doesn’t rely on
PPRiskMagnes?We’re not blocked only because we’re still using CocoaPods to integrate it, and we have a crucial deadline that’s taking priority over the goal of getting rid of CocoaPods. In six weeks, we’ll see.
👋 Hello everyone. We pushed a potential “fix” to a branch called
xcode-archive-test. With this change, we’re no longer experiencing any archive issues with PPRiskMagnes via SPM. Feel free to give this branch a try and let us know if it resolves your issue.@rursache is correct - for v5.4.2+, you no longer need to explicitly include
PPRiskMagnes,KountDataCollector, orCardinalMobile. As of now, you do still need to includePayPalDataCollectorfor PayPal, 3DS, and Local Payments/Same here 😃 my Feedback was acknowledge and I was told during a WWDC lab they are working on it. No timeline. (I hope a beta of Xcode 13). They confirm my hypothesis for the cause described here (at least told me it was a build system issue) https://github.com/braintree/braintree_ios/issues/679#issuecomment-853166124.
exactly in that order ☹️ builds fine but does not archive
EDIT: got it working by removing derived data folder (
sudo rm -rf ~/Library/Developer/Xcode/DerivedData)🎉
I do believe it’s an Xcode bug, and only once did I succeed in archiving. Dozens of attempts later with all manner of cleaning, resetting, re-downloading, removing and re-adding, I haven’t been able to Archive. I submitted our project to Apple, and it looks like another Apple engineer has taken on the Swift bug for it. I added @simonpierreroy’s info to that.
We’re using 5.3.0.
Hi everyone. We think this is likely an Xcode bug, but are still doing some testing internally. Like I said in my previous posts, we were only able to trigger the archive issues sometimes. Building & running the application, re-installing the package via SPM, and archiving on the command line all got things working for us.
@JackoPlane - people in this thread are saying that they don’t see archive issues on 5.3.0, however @sestevens and I were seeing some similar issues in our CI near that version release. We can’t say for sure that the issue is not present on 5.3.0, but you can give it a shot for now.
i’m having the same issue on xcode 11.5 - No such module ‘PPRiskMagnes’ - even on running the app.
i only need the braintree + paypal integration and it seems that PPRiskMagnes lib is still creating issues (last time i tried this integration was in february).
sometimes after multiple builds the app runs but i get a runtime crash:
what i tried:
Braintree is the only dependency that still keeps me from fully migrating from cocoapods to SPM. This is really annoying because all the other “big guys” already got SPM figured out (Stripe, Firebase, etc).
Seconded, I’m unable to update our project to 5.3.1 due to
No such module 'PPRiskMagnes', it’s not immediately obvious from this diff why this is now the case.