cyril
cyril

Reputation: 3005

How do I embed a third-party xcframework in my Xcode project?

I'm trying to embed the following third party framework in my Xcode project: https://dicomhero.com/downloads/ but Xcode complains that Command CodeSign failed with a nonzero exit code. I've tried one of several things including:

But none of them seem to have worked, and Xcode crashes at start time and suggest moving the framework to the Trash. Is this an issue I can fix on my end, or would I have to contact the developer? Any help would be greatly appreciated!

Upvotes: 3

Views: 841

Answers (2)

Paolo Brandoli
Paolo Brandoli

Reputation: 4750

Since the 6.0.0.0 release the XCFramework is distributed as a DMG archive. After unpacking the archive, run

xattr -r -d com.apple.quarantine dicomhero6.xcframework

Upvotes: 0

storoj
storoj

Reputation: 1867

I tried to download the framework using the link you provided, and then embed it into an empty project. Xcode showed the alert about using code from untrusted source.

Untrusted Developer Alert

When you download a file from internet it receives "quarantine" attributes:

$ xattr xcframework.zip 
com.apple.macl
com.apple.quarantine
com.apple.metadata:kMDItemDownloadedDate
com.apple.metadata:kMDItemWhereFroms
com.apple.lastuseddate#PS

com.apple.macl and com.apple.quarantine are the most interesting here.

Not sure what exactly macl means, but I assume it to be some kind of Access Control Layer. The presence of this attribute makes the OS to show this "untrusted developer" alert.

These attributes could be removed with xattr -d. com.apple.quarantine attr gets removed just fine, however com.apple.macl reappears after deleting it.

When you unzip a zip archive by just double clicking on it, Finder re-applies these com.apple.quarantine and com.apple.macl attributes to the unarchived file or directory. But if you decompress the archive with unzip, com.apple.macl will not be applied to the decompressed data.

You could download the archive and then do:

$ cd ~/Downloads
$ unzip xcframework.zip
$ sudo xattr -dr com.apple.quarantine dicomhero6.xcframework

Then drag and drop .xcframework to your Xcode project.

Alternatively you get rid of the "developer cannot be verified" error by just opening the Security and Privacy pane in the System Preferences and "Allow Anyway".

Security and Privacy pane

Upvotes: 2

Related Questions