I can not guarantee that this will solve your version of this problem. But I finally got my job.
The guy who said to remove i386 and x86_64 has a part of the answer.
For my purpose, I set up the architecture section as follows
Architectures <multiple values> Debug Standard Architectures <$(ARCHS_STANDARD)> Any iOS Simulator SDK <i386 x86_64> Any iOS SDK <$(ARCHS_STANDARD)> Release Standard Architectures <$(ARCHS_STANDARD)> Any iOS Simulator SDK <i386 x86_64> Any iOS SDK <$(ARCHS_STANDARD)> Base SDK <Latest iOS> Build active Architecture only <No> Supported Platforms <iOS> Valid Architectures <armv7 arm64 i386 x86_64>
Then I created a third-party goal. This is a collection (File-> new-> Target-> iOS-> Other-> Aggregate) I did not make changes to the build settings for this purpose, leaving them by default. In the Phase Build section, I dragged my previous target into the Target Dependencies section.
In the Run Script section, I posted the following.
# define output folder environment variable UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal # Step 1. Build Device and Simulator versions xcodebuild -target MiniZip ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" xcodebuild -target MiniZip ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" # make sure the output directory exists mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" # Step 2. Create universal binary file using lipo "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a" lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a" # Last touch. copy the header files. Just for convenience cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}/"
I tried to create the MiniZip library as a library with 4-sided fats, so when my Script says “MiniZip”, you obviously put any name on your target.
And my final result?
Admins-Mac-mini-2:scratch JoeC$ file libminizip.a libminizip.a: Mach-O universal binary with 4 architectures libminizip.a (for architecture armv7): current ar archive random library libminizip.a (for architecture i386): current ar archive random library libminizip.a (for architecture x86_64): current ar archive random library libminizip.a (for architecture arm64): current ar archive random library
Success! Well, for me one way or another. Hope this solves your problem!
Edit: I have to pay tribute to Ray Wenderlich. My Script is based on what it published.
jbcarpen
source share