Embed/Do Not Embed & Mach-O type

My Xcode project has the following configuration:

  • 1 iOS app target
  • 1 Xcode framework target (mach-o-type "Dynamic Library")
  • 5 static libraries

Dependencies:

  • All the static libraries are target dependencies of the framework.
  • The framework is the only target dependency of the iOS app.

For the iOS app target, within the General tab > Frameworks, Libraries & Embedded content, I've set the framework as "Do not embed"

So now I have a dynamic framework which won't be copied to the .app bundle in the build output.

As per my understanding, this should result in a runtime error, dyld should not be able to find the framework files as they were not embedded in the final .app bundle.

But regardless, my app runs without any errors, using all the methods exposed by the framework.

  • What is the correct understanding here?
  • What exactly does Embed/Do not embed mean (apart from excluding the files from .app bundle)
  • When both settings are specified, is there any priority or precedence of one setting over the other?
Answered by DTS Engineer in 861034022

Ah, I thought might be the case. The simulator works a bit like macOS, where Xcode sets things up so that your app can load a framework from the build products directory. That won’t work on a real device, where the framework must be embedded in the app’s bundle.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Are you testing this on a real device? Or in the simulator?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Hi. I'm testing this in the simulator.

Accepted Answer

Ah, I thought might be the case. The simulator works a bit like macOS, where Xcode sets things up so that your app can load a framework from the build products directory. That won’t work on a real device, where the framework must be embedded in the app’s bundle.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Embed/Do Not Embed & Mach-O type
 
 
Q