razorpay / razorpay-pod

:iphone: CocoaPod implementation of Razorpay's Payment SDK. Refer for instructions:
https://docs.razorpay.com/v1/page/ios-integration
MIT License
21 stars 18 forks source link

Failing to push to app store while archiving worked #129

Closed uchiha-itachi95 closed 2 years ago

uchiha-itachi95 commented 2 years ago

Description

I have integrated razorpay-pod with our ios app. Everything is working fine. Built the archive also. But failed to push it to app store.

Razorpay pod Version :

1.1.6

Xcode Version :

Version 12.3 (12C33)

What you did:

Built the archive. Was trying to push it to app store for TestFlight for internal testing. Got error in between. Screenshot below.

What happened:

It gave multiple errors regarding the binary that was sent to the app store. Screenshot below.

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

1. 2.

Suggested solution:

Code example, screenshot, or link to a repository:

Screenshot 2021-08-23 at 11 31 15 AM

uchiha-itachi95 commented 2 years ago

So the problem is it contains both the architecture for simulator and real device which of course is not allowed for play store release. So you have to strip out the simulator architecture before submitting to app store.

Just add the below run script in your build phase and you will be good to go.

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
FRAMEWORK_NAME="Razorpay.framework"
# Check if Framework is present.
FRAMEWORK_LOCATION=$(find "$APP_PATH" -name "$FRAMEWORK_NAME" -type d)
if [ -z $FRAMEWORK_LOCATION ]; then
echo "Couldn't find Razorpay.framework in $APP_PATH. Make sure 'Embed Frameworks' build phase is listed before the 'Strip Unused Architectures' build phase."
exit 1
fi
# This script strips unused architectures
find "$APP_PATH" -name "$FRAMEWORK_NAME" -type d | while read -r FRAMEWORK
do
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable)
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME"
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH"
EXTRACTED_ARCHS=()
for ARCH in $ARCHS
do
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
done
echo "Merging extracted architectures: ${ARCHS}"
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}"
rm "${EXTRACTED_ARCHS[@]}"
echo "Replacing original executable with thinned version"
rm "$FRAMEWORK_EXECUTABLE_PATH"
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
done