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.