26

Somehow "Always Embed Swift Standard Libraries" for all of my targets is YES. Probably due to historical development from Swift 1 to 5. I'm using Xcode 10.2 now, upgraded the targets and my "Swift language version" is 5 for all of them.

Out of interest I created an empty new project with Xcode 10.2 and it is created with "Always Embed Swift Standard Libraries" as NO for both Debug and Release builds.

I have a feeling that even if I leave it as it is, Apple will strip standard Swift libraries anyway as a part of thinning for iOS 12.2+?

So what's the correct default since swift 5? Any benefits from either keeping it at YES or changing to NO?

[Update] Thanks to Cœur for a comment. It really looks like that one of the CocoaPods versions did it. Project is set to NO, but all the targets using CocoadPods were YES.

2
  • 2
    While the default is NO, note that if you use a standard CocoaPods integration, some versions (like CocoaPods 1.6.1) may override ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES default value and set it to YES. This was made by github.com/CocoaPods/CocoaPods/pull/5732
    – Cœur
    Mar 27, 2019 at 7:42
  • Thank you for providing the possible cause of this YES value! I do use CocoaPods from the very early versions. Mar 27, 2019 at 8:57

4 Answers 4

17

The default for new projects is NO and (as far as I know) always has been. I have never had "Always embed" set to YES, and my projects have always worked just fine. So unless there is some really good reason why this was YES, it probably shouldn't have been.

Note that the libraries are stripped out only if you are building against the 12.2 SDK and going onto a machine with 12.2 (or later). The libraries are still needed to run on a 12.1 or earlier machine.

4
  • 3
    This setting only makes a difference if your app is pure Objective-C and is using some Swift frameworks: in that case, you would want it to YES.
    – Cœur
    Mar 27, 2019 at 7:40
  • Marking this as an answer. Plus comment from Cœur makes it probably 100% covered with when YES is needed. Mar 27, 2019 at 9:02
  • 1
    @Cœur I don't get the point why does pure Objective-C app which wants to use some Swift frameworks or libraries need to set this to YES?
    – Ravi Raj
    May 26, 2020 at 10:27
  • @RaviRaj because in the old times, some Swift standard libraries were not shipped in iOS due to the lack of ABI stability? And so, without those libs, your Swift dependencies wouldn't work. Not too sure about recent iOS releases.
    – Cœur
    May 27, 2020 at 2:09
5

I came here because I've updated my development environment to :

XCode 10.2 iOS 12.2 WatchOS 5.1.3

And my apps refused to even start on the watch, with a single message to console, saying library image not found. (using Swift4 build setting)

Setting "always embed" to on makes the app install process incredibly slow on the watch.

I updated the project to use Swift5, now the app at least starts up again.

0

FYI

If you set true for ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES on the target framework, you will probably receive ERROR ITMS-90206: Invalid Bundle.

In my case, I set true for target that is App / Unit Tests / UI Tests.

-3

If you set ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES NO your app may lead to crash while open with iOS 12.1 and lower version.

3
  • 1
    This doesn't seem to be true. All of my targets are now on NO and all of my apps support iOS 9 to 14. Built on iOS 14.1 SDK now, there are no problems whatsoever related to this being NO. Oct 30, 2020 at 17:31
  • That might be true. I'll update the answer if I identify it. thanks Oct 31, 2020 at 7:36
  • I am late.. but try this out.. "otool -L <your_app> or <.framework file>". See if the swift libs are referenced from @rpath like this developer.apple.com/library/archive/qa/qa1881/_index.html
    – Nikesh K
    Jun 1, 2021 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.