How to run an iOS project on Simulator with embedded frameworks not compiled for i386 x86_64

Dmytro Barabash
MobilePeople
Published in
4 min readDec 23, 2022

--

// TLDR; Create a separate target for it and make an empty stub for this class!

Imagine you have a framework embedded in your project but not compiled for i386 x86_64. This framework is private and outdated but you can’t remove it or replace it with a better solution because it’s a requirement from the customer side. So when you try to run this project for any simulator in Xcode you probably would face such an error:

ld: building for iOS Simulator, but linking in dylib built for iOS, file ‘/ProjectName/SomeFramework.framework/SomeFramework’ for architecture arm64

clang: error: linker command failed with exit code 1 (use -v to see invocation)

Below I’d explain my solution in the step-by-step workaround.

1. Create a copy target for a simulator run. More info here.

2. Check what frameworks in your app don’t support the simulator
You could check it with CLI ‘lipo -info yourlib’. More info here and here.

3. Remove from a new target not supported framework.

4. (Optional) Update a newly created scheme if you need it (ex. add a new build configuration for this target)

5. (Optional) If you need to check something in the code you may add a custom flag.

6. (Optional) Update your Build Phase for a new target. (ex. I had an error for the Firebase path so I’ve updated lines 4–8 in a new Target’s Build Phase to have the same target path as the base)

7. (Optional) Update your bridging headers if you have such. (ex. Now I have a base_header and a device_base_header so I’ve updated the path for both targets)

8. Create a new ‘layer’ where you could put your framework with its code. Important to select the needed target/s here. If you had created with a wrong target file then Add/Remove needed in Build Phases — Copy Bundle Resources.

OR

Note:
This is not a production-ready code and solution. I’ve only tried to show an idea of how you can figure it out.

Now you can test altogether. Select the needed scheme and run. (ex TestApp for your device and TestAppSimulator for a simulator).

// (Update) if you have a similar build issue when uploading to the Test Flight, there’s a workaround.

Errors:
ERROR ITMS-90209: “Invalid Segment Alignment. The app binary at ‘App.app/Frameworks/SomeSDK.framework/SomeSDK’ does not have proper segment alignment. Try rebuilding the app with the latest Xcode version.”

ERROR ITMS-90125: “The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple’s linker.”

ERROR ITMS-90125: “The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple’s linker.”

ERROR ITMS-90087: “Unsupported Architectures. The executable for App.app/Frameworks/AppSDK.framework contains unsupported architectures ‘[x86_64, i386]’.” ERROR ITMS-90087: “Unsupported Architectures. The executable for App.app/Frameworks/AppSDK.framework contains unsupported architectures ‘[x86_64, i386]’.

--

--