Using Unity iOS on Xcode 12.3 with the New Build System will throw a build-time error:
"Building for iOS, but the linked and embedded framework 'Leanplum.framework' was built for iOS + iOS Simulator."
Xcode now requires using xcframeworks instead of the fat/universal frameworks. XCFramework is a new way of packing and providing libs, in their different variants.
This format allows packing dependencies under all target platforms and architectures in one single bundle from the box, all builds of the library under all target platforms and architectures now can be packed into one single bundle with .xcframework extension.
Leanplum Unity package 3.1.0 still comes with a fat framework bundled for iOS. This is due to Unity still not supporting xcframeworks out of the box and that Unity exports the iOS project set to use the Legacy Build System (deprecated).
We now provide xcframework for download together with the Unity package, available here.
The zip contains dynamic (not static) both Leanpum framework and Leanplum xcframework.
In order to Archive and Distribute the app from Xcode, switch to the New Build System. This can be done from File -> Project Settings... or from the top bar's hummer-like icon:
Then the xcframework is added the same way as you would add a fat framework.
First, remove the Leanplum.framework from Unity-iPhone Target and add the Leanplum.xcframework:
Then do the same for the UnityFramework target:
Now the build and distribution will be successful.
If your iOS build from Unity is automated, the xcframework needs to be added as part of a PostProcessBuild script.