Releasing to Apple
    In Xcode, go to your app's target settings. On the Build Phases tab, Add New Run Script Phase and copy and paste the following script into the run script’s editor area and set it to use /bin/sh.
    This build script will strip out the simulator slices from the framework.
1
APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
2
3
# This script loops through the frameworks embedded in the application and
4
# removes unused architectures.
5
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK
6
do
7
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
8
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
9
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
10
11
EXTRACTED_ARCHS=()
12
13
for ARCH in $ARCHS
14
do
15
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
16
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
17
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
18
done
19
20
echo "Merging extracted architectures: ${ARCHS}"
21
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
22
rm "${EXTRACTED_ARCHS[@]}"
23
24
echo "Replacing original executable with thinned version"
25
rm "$FRAMEWORK_EXECUTABLE_PATH"
26
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
27
28
done
Copied!
    The script will look through your built application’s Frameworks folder and make sure only the architectures you’re building for are present in each Framework.
    Create an Archive build of the Consumer Project (Product > Archive in the menu) and submit it for validation (Window > Organizer in the menu; select the project in the Organizer, press “Validate…” button and follow on screen instructions). The app should pass validation as the simulator architectures were removed from the framework during the build process.
    Once the validation success Upload to App store.
Copy link