I am getting two builds of the same codebase delivered as two separate frameworks: one for iOS device and one for simulator
Is there a way to conditionally include one or the other depending on the target of my app?
I am getting two builds of the same codebase delivered as two separate frameworks: one for iOS device and one for simulator
Is there a way to conditionally include one or the other depending on the target of my app?
You can write script phase to replace framework file with some conditional( maybe is target architecture).
Here is the solution. Assume the frameworks for iOS device and simulator are at folders $device
resp. $simulator
. The merged framework will go into $merged
:
$simulator
into $merged
$device
into $merged
(for sure this will overwrite same-named binaries we copied in the step before, but we just want to make sure we have everything else (module mappings etc.); the actual merging of same-named binaries happens in the next step)$name
that exists both in $simulator
and $device
, do:
lipo -create $device/name $simulator/$name -output $merged/$name
The above can easily be automated with a script.
I verified the approach with a set of frameworks we use with Flutter and it works. The easiest way is to add the $merged
folder as a vendored framework into the podspec file