Flutter - Code signing "App.framework" failed

1,128

Solution 1

After a lot of searches and tries, I found that I have an error in provisioning, and once I solved this I managed to validate the app and upload it to App Store successfully.

Solution 2

Here is how you can solve this error: You must add script to your xcode that will remove the non used code of 3rd party libraries. When you open your flutter iOS project in xcode you will see in the build phases section that flutter already has a script in place. Do not mess with this script, instead you will add a new one . Like here is this image: enter image description here

Then you will have something like this:

enter image description here

After this open the run script and place this code:

# Type a script or drag a script file from your workspace to insert its path.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_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=()

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

if you encounter an error stating that there is a syntax error in the script try removing unrecognized characters that may have been copied while you were trying to copy the script since xcode does not process them and it happened with me. So copy the code and place in a different code editor that is capable of processing such characters (visual studio for example) and then remove the unwanted characters from the end of certain lines. So now in total you have two scripts running

Share:
1,128
Admin
Author by

Admin

Updated on November 27, 2022

Comments

  • Admin
    Admin over 1 year

    I am new to flutter and trying to realise my first app on iOS however, i am facing this issue and try to resolve it since the past week.

    1.After running "flutter build ios", the build and signing is successful

    2.The project archive is also a success

    (Issue) But when I click on validate App. I get the below issue, I have spent a lot of time and done a lot of debugging but could not find a reason for this issue.

    Screenshot of the error message enter image description here

    terminal output : flutter doctor -v

    
    [✓] Flutter (Channel stable, 1.22.3, on Mac OS X 10.15.7 19H2, locale en-GB)
    • Flutter version 1.22.3 at /Users/sohumwahi/Library/flutter
    • Framework revision 8874f21 (6 days ago), 2020-10-29 14:14:35 -0700
    • Engine revision a1440ca392
    • Dart version 2.10.3
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/sohumwahi/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android
    Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
    1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.0
    
    [!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build
    1.8.0_242-release-1644-b3-6222593)
    
    [✓] VS Code (version 1.50.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0
    
    [✓] Connected device (1 available)
    • iPhone 11 Pro (mobile) • 093FA4C3-39F3-4D69-B945-DDD155FDBD49 • ios •
    com.apple.CoreSimulator.SimRuntime.iOS-14-1 (simulator)
    
    ! Doctor found issues in 1 category.