So i am trying to use the shopify API. When i archive the app and validate it then there are no issues but when i submit it to the app store then it gives me the following issues.
- ERROR ITMS-90087: "Unsupported Architecture. Your executable contains unsupported architecture '[x86_64, i386]'."
- ERROR ITMS-90209: "Invalid segment Alignment. The App Binary at SJAPP.app/Frameworks/Buy.framework/Buy does not have proper segment alignment. Try rebuilding the app with the latest xcode version." (I am already using the latest 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."
- WARNING ITMS-90080: "The Executable Payload/..../Buy.framework is not a Position Independent Executable. Please ensure that ur build settings are configured to create PIE executables."
If you are using
Carthage
make sure yourEmbed Frameworks
Build Step
is before theCarthage
copy-frameworks
In some unusual cases (example: Lottie-iOS framework):
you will have it simply in "Link Library" as usual.
However you have to also explicitly add it in "Embed Frameworks" (even though that seems pointless, since it works perfectly when you have it only in "Embed Frameworks"),
and put it in copy-frameworks
and ensure copy-frameworks is after "Embed Frameworks"
If you're using Carthage then you may experience this issue because the project is:
carthage copy-frameworks
build phase.This action filters frameworks to a list of valid architectures (code).
Setting up the copy-frameworks build phase
From the Carthage building for iOS steps:
I will add my 2 cents here (in a less scary way :-). I have encountered quite a number of fat libraries from Vendors that (for some reason) do not work the normal way by adding them to the
Frameworks
directory as documented by Apple. The only way we have been able to make them work is by pulling the.framekwork
right into the project directory and linking theEmbedded Frameworks
andLink Binary with Libraries
manually in Build Settings. This seem to have worked without any issues, however, as with any fat library they come with the extraneous Simulator Architecturesi386
andx86_64
along with thearm
architectures.A quick way to check the architectures on the fat library is
Which should spit an output something like this
This confirms that you will need to "trim the fat" (namely
i386
&x86_64
) from your framework prior to iTunesConnect Archival upload, which doesn't allow these architectures (since they are unsupported for iOS).Now, all the answers (or atleast some of the answers) here provide these wonderful Run Scripts that I am sure works really well, but only if your Framework resides in the
Frameworks
directory. Now unless you are a shell script junkie, those scripts without modifications, won't work for the scenario I explain above. However, there is a very simple way to get rid of thei386
&x86_64
architectures from the framework.Change directory directly into the
.framekwork
, likecd YourProjectDir/YourProject/YourLibrary.framework
Run the series of commands as shown below-
$ mv YourLibrary YourLibrary_all_archs
$ lipo -remove x86_64 YourLibrary_all_archs -o YourLibrary_some_archs
$ lipo -remove i386 YourLibrary_some_archs -o YourLibrary
$ rm YourLibrary_all_archs YourLibrary_some_archs
A few things to note here -
lipo -remove
has to be done once for each architecture to remove.lipo
does not modify the input file, it only produces a file so you have to runlipo -remove
once forx86_64
andi386
. The commands above is simply doing that by first renaming the executable and then eventually removing the desired archs, and then cleaning up the left over files. And that's it, you should now see a green check mark in Application Loader Archival upload to iTunesConnect.Things to keep in mind : The above steps should only be done while production build, since the
.framework
will be stripped off the simulator architectures, builds on simulators will stop working (which is expected). In development environment, there should be no need to strip the architectures off of the.framework
file since you want to be able to test on both Simulator and a physical device. If your fat library resides in theFrameworks
folder in the project then please look at the accepted answer.Answer given by pAkY88 works, but I faced the same problem as Mario A Guzman in https://stackoverflow.com/a/35240555/5272316: once we cut off unused architectures we can't run script any more since it tries to remove not existing slices, because xcode doesn't re-embed binary every time. Idea was - just remove i386 and x86_64 slices when building for archive, so I modified script:
This script simply removes i386 and x86_64 slices from fat binary (if they exist) if running not for simulator (that means destination folder isn't like "Debug-iphonesimulator").
Sorry, I'm not familiar with shell scripts, so may be someone could write it more elegant way. But it works)
Thanks to all above answers. Here is script working with swift 4.2
I had same issue even after adding the script and updating the framework a few times.
Make sure in xCode the script is added at the end, after the embed. I think I accidentally moved the script before the embedded framework.
Note: I have xCode 9.1