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):

  1. Open the SPMTest app project
  2. Remove a reference of the optional Braintree libraries (ex. Union Pay, Venmo, etc)
  3. Set the archive build configuration to “Debug”
  4. Perform a clean archive

Expected behavior The archive completes successfully

Screenshots Screen Shot 2021-05-18 at 9 06 04 AM

Screen Shot 2021-05-18 at 9 52 33 AM

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)

Most upvoted comments

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.

Screen Shot 2021-06-02 at 12 18 26 PM

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, or CardinalMobile. As of now, you do still need to include PayPalDataCollector for 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.

Hi @rursache - remove the dependency, clean, re-build etc?

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:

dyld: Library not loaded: @rpath/PPRiskMagnes.framework/PPRiskMagnes
  Referenced from: /private/var/containers/Bundle/Application/0C2D8DA4-D8DB-4086-8E32-65B42C27799B/<APPNAME>.app/<APPNAME>
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib

what i tried:

  • cleaning the project about 1233923 times
  • removing and re-adding the package around the same amount of times
  • version 5.3.0, 5.3.1, 5.3.2
  • multiple branches (master, test-xcframework-zips, spm-binary-fix-xcode12-5)
  • creating an empty project with the same braintree targets
  • not checking PPRiskMagnes when adding braintree and manually linking + embed & sign of that PPRiskMagnes.xcframework
  • build/archive via command line as suggested above, i always get
import PPRiskMagnes
       ^

** ARCHIVE FAILED **

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.