1

I have created a custom universal framework and I need to add this scripted to its build phases so that the Universal framework will remove unused architectures. Which is necessary if I ever plan on using for the app store in an app.

But I am getting compile error (Command PhaseScriptExecution failed with a nonzero exit code): enter image description here

enter image description here

Script:

# Type a script or drag a script file from your workspace to insert its path.
FRAMEWORK="TestFramework"
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 "${EXTRAFRAMEWORK="TestFramework"
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"CTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"

This is from a tutorial here: Writing Custom Universal Framework in Xcode 10.2 and iOS 12

The problem could be as simply a improperly written string or a space where it shouldn't be, but I don't know.

Findings: I know it has something to do with either the for loop or something inside of it because when I delete the for loop and it's contents/nest-code that error goes away.

Reproduce: to reproduce the error you can simply make a dummy Xcode project and then Select the Project tab called → yourProject.xcodeproj, Choose Target → Project Name → Select Build Phases → Press "+" → New Run Script Phase → Name the Script as "Remove Unused Architectures Script" → and finally just copy and past the code.

asked Jan 28, 2020 at 5:30
1
  • any findings?? i have same issue Commented Aug 14, 2020 at 12:55

1 Answer 1

1

The for loops may be to blame here. They could capture any exit codes that happen. I experienced a similar issue on this.

answered Oct 27, 2020 at 14:57
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.