Getting Started With Dynamic Libraries

With the release of Structure SDK (for iOS) 0.10.1 we are no longer shipping a static binary with our Structure.framework. While dynamic frameworks were not allowed prior to iOS 7.0, we’ve realized that any dependency or symbol collision we might have outside of our public API will cause problems as long as we ship with a static binary. So now, our framework is dynamically linked. To use it, please follow these steps:

1. Embed the framework into your app.
Go to your app’s target in Xcode, and then navigate to the “General” tab. From there you will be able to embed the framework by adding it to the “Embedded Libraries” section

2. Strip out the iphonesimulator targets.
Unfortunately, Apple is very strict about what architecture you can ship to the app store. Since our framework contains binaries for both iphoneos (arm64) and iphonesimulator (x86_64), you’ll need to strip out the iphonesimulator targets if you want to ship to the app store. Fortunately you can add a simple script to your build phases to make this work. Make a “run script” phase on your “Build Phases” tab, and add the following script (you can use /bin/sh as the shell):


# This script loops through the frameworks embedded in the application and
# removes unused architectures.
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)


for ARCH in $ARCHS

echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"

echo "Replacing original executable with thinned version"


This script is generic and so it should work without any dependencies or changes.

This is the solution that we will be using moving forward, so that some of our dependencies (Eigen3, OpenCV) don’t collide with dependencies that developers are using.

If you have any issues with the dynamic library update, please post your question here or email

1 Like

Need help with this, thanks.

After doing this:

I get this:

Hi OGuler,

Can you try clearing your derived data, and re-building?

This will happen if you have Structure.framwork in the “Embed Framworks” and not in the “Link Binary With Libraries”. It needs to be in both places.

1 Like

Thanks @n6xej this resolved the issue. :fu:

For everyone else who struggle with this find the screenshots below from my “Build Phases”

Link Binary With Libraries

Embed Frameworks:


Hey any idea how to embed binaries in a Carthage file.??

Not sure what you are asking? Is your Carthage file building a static or dynamic framework?

We’ve got an issue with this solution. When running in our device in debug, we got a “No code signature found” error.
We resolved our issue using the file from realm-cocoa repository. The script do more verification and re-sign modified frameworks.

Hi @JacobErvin,
I downloaded the SDK 0.11.2 (released January 7, 2020) for iOS and tried to run the from the Samples provided with the SDK on an iPhone-7 target (iOS 13.3.1).
The app build as usual but crashes once launched on target and I get the following message:

dyld: Library not loaded: @rpath/Structure.framework/Structure

Referenced from: /private/var/containers/Bundle/Application/3F05438E-967C-4F9F-A701-6F7AD0347CA3/

Reason: no suitable image found. Did find:

/private/var/containers/Bundle/Application/3F05438E-967C-4F9F-A701-6F7AD0347CA3/ code signature invalid for '/private/var/containers/Bundle/Application/3F05438E-967C-4F9F-A701-6F7AD0347CA3/’

/private/var/containers/Bundle/Application/3F05438E-967C-4F9F-A701-6F7AD0347CA3/ stat() failed with errno=25

I think it’s related to the dynamic linking so I tried the script you posted above (BTW no Embedded Libraries anymore under Xcode10 - I assume it’s called Embed Frameworks or Link binary with libraries now) with no success!

Any ideas?

– EDIT.1 –

Ok, I noticed that the shell script is already in the Scanner project.
I still suspect that the error comes from the dynamic linking.

– EDIT.2 –
So this seems to be a known issue since iOS 13.3.1:

Thanks in advance