Pretty desperate, because my app is broken on iOS 10 and I can't submit the fix because itunes connect keeps rejecting the build.
My app runs fine on devices & simulators, but when I submit it, I get the Invalid Bundle - One or more dynamic libraries that are referenced by your app are not present in the dylib search patherror emailed to me about half an hour after the upload completes successfully.
Following the advice on this thead here, namely running
otool -L, I can see that the app's main executable has all of its @rpath/...dylib files in the Frameworks/folder as expected, but, the appex's executable is missing some Swift libs.Here's the output from
otool -L on the appex:Watch Extension:
/System/Library/Frameworks/WatchKit.framework/WatchKit (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Foundation.framework/Foundation (compatibility version 300.0.0, current version 1349.0.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.0.0)
/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation (compatibility version 150.0.0, current version 1348.0.0)
/System/Library/Frameworks/UIKit.framework/UIKit (compatibility version 1.0.0, current version 3599.4.0)
/System/Library/Frameworks/WatchConnectivity.framework/WatchConnectivity (compatibility version 1.0.0, current version 116.0.0)
@rpath/libswiftCore.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftCoreLocation.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftDarwin.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftDispatch.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftFoundation.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftHomeKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftObjectiveC.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftSceneKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftUIKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftWatchKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftsimd.dylib (compatibility version 1.0.0, current version 800.0.46)The following are NOT in the
Frameworks/ folder (but all the others are): @rpath/libswiftHomeKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftSceneKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftWatchKit.dylib (compatibility version 1.0.0, current version 800.0.46)
@rpath/libswiftsimd.dylib (compatibility version 1.0.0, current version 800.0.46)Why are these swift dylibs missing? I regenerated my pods project via
pod install, didn't change anything. I didn't see any warnings. I checked the build (archive)'s log output, no warnings there either. How can I get these included like they should be?In my main app's target, Always Embed Swift Standard Libraries is set to yes. In Watch and Watch Appex targets, this is set to no to avoid the rejection for having duplicates (good). I tried setting
EMBEDDED_CONTENT_CONTAINS_SWIFT to yes in my appex as described in that other thread, but that didn't make any difference.
It took 12 hours to figure this out, but this is what fixed it -- changing the ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES build setting like this:
App target (main target) -- set to NO (mine was YES)
Watch target -- set to YES (mine was NO)
Watch App Extension target -- set to NO (mine was YES)