# Problems with SPM Binary Distribution

**URL:** <https://forums.swift.org/t/problems-with-spm-binary-distribution/40457>\
**Category:** Using Swift\
**Tags:** packagemanager, binary-framework\
**Created:** [September 21, 2020, 1:16am UTC](https://forums.swift.org/t/problems-with-spm-binary-distribution/40457 "2020-09-21T01:16:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![RogerTheShrubber](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rogertheshrubber/32/13156_2.png) [@RogerTheShrubber](https://forums.swift.org/u/RogerTheShrubber)\
**Post date:** [September 21, 2020, 1:16am UTC](https://forums.swift.org/t/problems-with-spm-binary-distribution/40457/1 "2020-09-21T01:16:11Z")

</div>

I'm having trouble distributing a xcframework binary via Swift Package Manager.

I'm trying to adapt [this](https://github.com/MailCore/mailcore2) library for SPM. I've been able to build an xcframework that works great if you download it and manually add it to your project.

However, when I distribute the same file using SPM, I'm encountering errors.

First, it was crashing at launch saying "dyld: Library not loaded" and "Reason: image not found".

Now I can't even get that far and it's not able to install. Seems like it's not signing it correctly. It says "Unable to install" and then when I hit details it tells me:

```swift
Unable to install "mailcoreTest"
Domain: com.apple.dt.MobileDeviceErrorDomain
Code: -402620388
--
No code signature found.

```

If you want to take a look you can download a zipped xcarchive [here](https://downloads.maddux.cloud/mailcore2-apple-xcframework/).

And [here's](https://github.com/mattmaddux/mailcore2) my fork if you want to take a look at the Package.swift or try the Swift Package.

---

<div class="post-metadata">

**Author:** ![linqingmo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/linqingmo/32/2442_2.png) [@linqingmo](https://forums.swift.org/u/linqingmo)\
**Post date:** [September 21, 2020, 1:55am UTC](https://forums.swift.org/t/problems-with-spm-binary-distribution/40457/2 "2020-09-21T01:55:06Z")

</div>

> [@SwiftPM binaryTarget dependency and code signing](https://forums.swift.org/t/swiftpm-binarytarget-dependency-and-code-signing/38953/20):
>
> I was finally able to bypass this No code signature found issue. As the last build phase, I have added a script which signs the frameworks inside the compiled app, meaning all frameworks inside $CODESIGNING\_FOLDER\_PATH/Frameworks. Unfortunately, I can't share my script since it is based on a codesign.py file which SAP published as part of their proprietary SAP Cloud Platform SDK 5.0 ([Version 5.0 of CP SDK for iOS Released | SAP Blogs](https://blogs.sap.com/2020/03/06/cp-sdk-for-ios-5.0-released/)). Without googling, I guess there are a few more scripts avail…

---

<div class="post-metadata">

**Author:** ![paulb777](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/paulb777/32/7986_2.png) [@paulb777](https://forums.swift.org/u/paulb777)\
**Post date:** [September 21, 2020, 2:09am UTC](https://forums.swift.org/t/problems-with-spm-binary-distribution/40457/3 "2020-09-21T02:09:48Z")

</div>

Xcode 12.0 had a regression from the Xcode 12 betas handling binary xcframeworks containing static frameworks.

More details, discussion, and workarounds at [SwiftPM binaryTarget dependency and code signing - #18 by seanreinhardtapps](https://forums.swift.org/t/swiftpm-binarytarget-dependency-and-code-signing/38953/18) and [https://github.com/firebase/firebase-ios-sdk/issues/6472#issuecomment-694449182](https://github.com/firebase/firebase-ios-sdk/issues/6472#issuecomment-694449182)

---

<div class="post-metadata">

**Author:** ![RogerTheShrubber](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rogertheshrubber/32/13156_2.png) [@RogerTheShrubber](https://forums.swift.org/u/RogerTheShrubber)\
**Post date:** [September 21, 2020, 2:33pm UTC](https://forums.swift.org/t/problems-with-spm-binary-distribution/40457/4 "2020-09-21T14:33:39Z")

</div>

Thanks both of you for the help. I was pretty convinced I had misconfigured something, so I didn't actually consider that it was a known issue with Xcode.
