1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Issue Archiving iOS App with Notification Service Extension: No Architectures in...

Discussão em 'Mobile' iniciado por Stack, Outubro 17, 2024 às 09:43.

  1. Stack

    Stack Membro Participativo

    I'm working on a Flutter project, and I need to display an image in my push notifications. I'm using the awesome_notifications plugin, which works perfectly on Android. However, for iOS, I added a Notification Service Extension (NSE) in Xcode to handle this.

    Initially, I encountered the "Cycle inside Runner" error, which I fixed by changing the build phase order. Specifically, I moved Embedded Foundation Extension above Run Script, and after that, I was able to build the app without any errors.

    However, when I try to archive the app, I get the following error:

    No architectures in the binary. Lipo failed to detect any architectures in the bundle executable.


    My Build Phase Setup:

    1-Target Dependency: Includes MyNotificationService (Runner).
    2-EmbeddedFoundation Extension: Includes MyNotificationService.appex.
    3-In the general tab, under Frameworks, Libraries, and Embedded Content, I also see MyNotificationService.appex.

    and If I remove MyNotificationService.appex from General > Frameworks, Libraries, and Embedded Content, it automatically gets removed from Build Phases > Target Dependency. If I remove it from Build Phases > Embedded Foundation Extension, it also gets removed from the General tab. Here is the script I added to the Run Script phase

    /bin/sh "$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh" build
    APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
    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 "Current architectures in $FRAMEWORK_EXECUTABLE_NAME:"
    lipo -info "$FRAMEWORK_EXECUTABLE_PATH"
    EXTRACTED_ARCHS=()

    for ARCH in $ARCHS
    do
    if [[ "$ARCH" == "i386" || "$ARCH" == "x86_64" ]]; then
    echo "Removing $ARCH from $FRAMEWORK_EXECUTABLE_NAME"
    lipo -remove "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -output "$FRAMEWORK_EXECUTABLE_PATH-$ARCH"
    EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH")
    fi
    done
    echo "Merging remaining architectures:"
    lipo -create "${EXTRACTED_ARCHS[@]}" -output "$FRAMEWORK_EXECUTABLE_PATH-merged"
    rm "${EXTRACTED_ARCHS[@]}"
    if [ -f "$FRAMEWORK_EXECUTABLE_PATH-merged" ]; then
    echo "Replacing original executable with thinned version"
    rm "$FRAMEWORK_EXECUTABLE_PATH"
    mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH"
    else
    echo "Skipping replacement; no merged file created for $FRAMEWORK_EXECUTABLE_NAME"
    fi
    echo "Updated architectures in $FRAMEWORK_EXECUTABLE_NAME:"
    lipo -info "$FRAMEWORK_EXECUTABLE_PATH"
    done


    I’ve tried adjusting the build phases and adding this script, but the archiving issue persists. How can I resolve the No architectures in the binary error while keeping the Notification Service Extension functional?[​IMG] [​IMG]

    Continue reading...

Compartilhe esta Página