From 0bd399a89c886d43d214969b2afee7d4f34d6c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Hern=C3=A1ndez?= <34726944+hugohernandez@users.noreply.github.com> Date: Mon, 11 Mar 2019 12:48:30 -0600 Subject: [PATCH] *Remove Unused Architectures instructions added. --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index ccae0da..abccb33 100644 --- a/README.md +++ b/README.md @@ -145,3 +145,28 @@ func failToken(error: NSError) { print("\(error.code) - \(error.localizedDescription)") } ``` + +## Remove Unused Architectures (for production only) + +The universal framework will run on both simulators and devices. But there is a problem, Apple doesn’t allow to upload the application with unused architectures to the App Store. + +Please make sure that you have "Remove Unused Architectures Script" added in your project while releasing your app to App Store. + +- Select the Project -> Choose Target -> Project Name -> Select Build Phases -> Press "+" -> New Run Script Phase -> Name the script as "Remove Unused Architectures Script". + +```javascript +FRAMEWORK="Openpay" +FRAMEWORK_EXECUTABLE_PATH="${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/$FRAMEWORK.framework/$FRAMEWORK" +EXTRACTED_ARCHS=() +for ARCH in $ARCHS +do +lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" +EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH") +done +lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}" +rm "${EXTRACTED_ARCHS[@]}" +rm "$FRAMEWORK_EXECUTABLE_PATH" +mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH" +``` + +Thats all !. This run script removes the unused simulator architectures only while pushing the application to the App Store.