Library Not Found Issue When Running on an iOS Device Using Swift Package Manager
Q: I’m using Swift Package Manager, and I’m getting the following “Library Not Found” issue when launching my app on a real iOS device:
dyld: Library not loaded: @rpath/PSPDFKit.framework/PSPDFKit Referenced from: /private/var/containers/Bundle/Application/ED1962E0-BA44-463B-B22C-2AB0447F9C13/Catalog.app/Catalog Reason: no suitable image found. Did find: /private/var/containers/Bundle/Application/ED1962E0-BA44-463B-B22C-2AB0447F9C13/Catalog.app/Frameworks/PSPDFKit.framework/PSPDFKit: code signature in (/private/var/containers/Bundle/Application/ED1962E0-BA44-463B-B22C-2AB0447F9C13/Catalog.app/Frameworks/PSPDFKit.framework/PSPDFKit) not valid for use in process using Library Validation: mapping process and mapped file (non-platform) have different Team IDs dyld: launch, loading dependent libraries DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
A: This issue occurred because Xcode failed to sign the frameworks provided by SwiftPM with your app’s signing identity. It’s a known issue (SR-13343) affecting Xcode 12.2 or earlier.
The issue has been fixed in Xcode 12.3. Update to the latest version of Xcode to fix this issue.