getsentry / sentry-cordova

The official Sentry SDK for Cordova
https://sentry.io/
MIT License
68 stars 55 forks source link

IOS - Issue #311 still occurs not resolved. #320

Open fbfdsouza opened 5 months ago

fbfdsouza commented 5 months ago

the issue https://github.com/getsentry/sentry-cordova/issues/311 still occurs, and not being able to extract the arm64 architecture from the path since it's not a fat file, makes it impossible to publish on the app store.

Tried the latest sentry-cordova 1.2.0, same issue is happening.

image

lucas-zimerman commented 5 months ago

Hi, could you share your Sentry strip unused archs form Framework script that is used on your project? Also is the project working if you remove this script?

fbfdsouza commented 5 months ago

I used this

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"

This script loops through the frameworks embedded in the application and

removes unused architectures.

find "$APP_PATH" -name '*.framework' -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=()
GOOD_ARCHS=()
PRESENT_ARCHS=($(lipo -archs "$FRAMEWORK_EXECUTABLE_PATH"))
if [[ "${#PRESENT_ARCHS[@]}" -lt 2 ]]; then
    echo "Framework is not a Fat binary, skipping..."
    continue
fi
for ARCH in "${PRESENT_ARCHS[@]}"; do
    if [[ "$ARCH" != x86_64 && "$ARCH" != i386 ]]; then
        echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
        lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
        GOOD_ARCHS+=("$ARCH")
        EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    fi
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

but it will skip the Sentry framework because it is not a Fat binary and I believe this is why it won't even work for sending errors to Sentry on Ios...

not using this script at all seems not to produce any errors, I'm not sure if the binaries are extracted correctly though... I will try to see if the step for publishing on the app store won't fail and if iOS can send errors to sentry...

fbfdsouza commented 5 months ago

@lucas-zimerman We did the publishing step removing the unused architectures script and it got broken... we're not able to send it to the Apple store.

Error: [13:10:42]: ERROR: Asset validation failed (90087) Unsupported Architectures. The executable for OurProjectName.app/Frameworks/Realm.framework contains unsupported architectures '[x86_64, i386]'. (ID: 545d4a32-b2fc-4f00-b907-3856872d0790)

github-actions[bot] commented 4 months ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

fbfdsouza commented 4 months ago

any updates on this issue?

igorsantos07 commented 4 months ago

Looking forward to get this solved for real - we're stuck without Cordova on our app for many months 😞


Edit: I'm unable to make sure it's working because I can't even get the lib to run properly in our scenario. I'm not sure it ever worked 100% correctly inside Cordova. See referred issue below.

lucas-zimerman commented 4 months ago

Hi, are you running on a Mac M1 or Intel? also which targets are you building your app? (Iphone, Ipad, mac,...)?

fbfdsouza commented 4 months ago

mac M1 here @lucas-zimerman

lucas-zimerman commented 3 months ago

Thanks for answering, we'll investigate this issue further more. Additional, are you targeting only iPhones/iPad? or other platforms like MacOS or apple watch?

fbfdsouza commented 3 months ago

hi thanks @lucas-zimerman, we in our case only iphones.