Error loading RealmSwift framework in iOS app

I’m encountering an issue loading the RealmSwift framework in my iOS app, and I’m hoping someone can provide some guidance.

I followed the guide in the MongoDB documentation and enabled “Embed & Sign”. The app builds fine, but it has a runtime error with the following:

````Library not loaded: @rpath/RealmSwift.framework/Versions/A/RealmSwift
not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)
dyld[8957]: Library not loaded: @rpath/RealmSwift.framework/Versions/A/RealmSwift
  Referenced from: <63059F97-7A3A-36E0-9EE5-F2518E41E7E0> 
/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/WoziDataStatic
  Reason: tried: 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/RealmSwift.framework/Versions/A/RealmSwift' (no such file), 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' (code signature in <EF3CAE9F-A6F5-374E-A2E2-6E0E820B7CDA> 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' (code signature in <EF3CAE9F-A6F5-374E-A2E2-6E0E820B7CDA> 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), 
'/System/Volumes/Preboot/Cryptexes/OS/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' (no such file), 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' (code signature in <EF3CAE9F-A6F5-374E-A2E2-6E0E820B7CDA> 
'/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), 
'/System/Volumes/Preboot/Cryptexes/OS/Users/*/Library/Developer/Xcode/DerivedData/Wozi-*/Build/Products/Debug/PackageFrameworks/RealmSwift.framework/Versions/A/RealmSwift' (no such file)

I started getting this error inconsistently after I updated [realm-core-14.5.2] → [realm-core-14.6.2]. I did not realize I was supposed to “Embed & Sign” the library, but after doing that the problem appears to have gone away (I’ve only built the app twice since I made that change). Prior to that I was able to fix it by deleting my derived data folder (clean build). You might want to double check that you have that setting properly set and do a clean build. I will post back if I get the issue again. I am running Xcode 15.3.