Xcode 10.2 does not always add libswiftSwiftOnoneSupport.dylib to ipa

Building an iOS Application using Xcode 10.2, MacOS 10.14.4.

Mixed Objective-C and Swift project.

I normally use xcodebuild to build the project.


So I'm having a bit of a odd problem and I can't seem to figure out what is going wrong. My two macbooks are running the same version of MacOS and Xcode, but they produce different ipa files. One of the macs produce an IPA that does not contain the libswiftSwiftOnoneSupport.dylib file.


If I build the app on the two machines and compare the IPA folders (rename to zip, uncompress and compare), the file "Payload/AppName.app/Frameworks/libswiftSwiftOnoneSupport.dylib" is not added when building on one of the machines. When I send this ipa to testflight, it crashes if the phone is running iOS 12.1 or older. It works on ios 12.2.


When I build on the other machine, the ipa contains the "Payload/AppName.app/Frameworks/libswiftSwiftOnoneSupport.dylib" and the app works fine on all supported ios versions. 10.0 or newer.


I've looked at the build logs (around 20000 lines of logs) and it's obvious the libswiftSwiftOnoneSupport.dylib gets copied into the archive when I build on one machine, but it doesn't get copied when I build on the other machine.


"libswiftSwiftOnoneSupport" is mentioned 22 times in one log, and zero times in the other one. The "CopySwiftLibs" commands look the same in both logs.


So, does anyone know how xcode decides what swift libraries to add to the ipa?

Answered by mobkey in 356357022

The problem seems to be that the application target itself did not require the "libswiftSwiftOnoneSupport.dylib", it was only required by one of the included frameworks. (Meaning that it WAS required, but xcode could not figure that out).


My main question stays unanswered, is there any way to figure out how xcode decides what frameworks to include in the IPA, or is that just undocumented and random?


A workaround for this is to add a Swift "print" statement to the application, thereby hinting to the build system that the library is required. . This hints to the build system that all Swift libraries should be included, and now the application works.


I just added a

print ("nothing")

statement in my app delegate.

Accepted Answer

The problem seems to be that the application target itself did not require the "libswiftSwiftOnoneSupport.dylib", it was only required by one of the included frameworks. (Meaning that it WAS required, but xcode could not figure that out).


My main question stays unanswered, is there any way to figure out how xcode decides what frameworks to include in the IPA, or is that just undocumented and random?


A workaround for this is to add a Swift "print" statement to the application, thereby hinting to the build system that the library is required. . This hints to the build system that all Swift libraries should be included, and now the application works.


I just added a

print ("nothing")

statement in my app delegate.

Xcode 10.2 does not always add libswiftSwiftOnoneSupport.dylib to ipa
 
 
Q