Xcode 10: Code Signing my App+Framework fails, because of failure signing 3rd party dependency framework (PromiseKit). Works in Xcode 9

前端 未结 3 1133
粉色の甜心
粉色の甜心 2021-02-04 01:36

I have an Xcode 10 - iOS12 swift project that links against My own framework (also Xcode 10 + iOS12).

The app project is referencing my framework project as a sub-proje

相关标签:
3条回答
  • 2021-02-04 01:51

    This is what worked for me, I have application and 2 in-house built frameworks, say A $ B.

    Application needs A, but A needs B and since Apple doesn't recommend nesting frameworks, so both A and B had to be included in the app.

    This is what my Xcode project looks like.

    SOLUTION

    In the application, under Frameworks, Libraries and Embedded Content, select Embed & Sign for all necessary frameworks. (as shown below)

    But for all the custom framework projects, under Frameworks and Libraries section, select Do Not Embed. (as shown below) This fixed the issue for me

    0 讨论(0)
  • 2021-02-04 02:07

    Try this! It worked for me and many other people:

    Goto

    Build phases > Add > New Run Script Phase

    The code should work for any default shell, but I recommend just using /bin/sh

    and include the following code:

    # Type a script or drag a script file from your workspace to insert its path.
    # skip if we run in debug
    if [ "$CONFIGURATION" == "Debug" ]; then
    echo "Skip frameworks cleaning in debug version"
    exit 0
    fi
    
    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=()
    
    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
    

    It seems hat some frameworks ship architectures, that will not be used in the application. Xcode will refuse to sign them. The above script removes unused architectures.

    Credits: Some guy at GitHub, I can't find the exact source anymore.

    0 讨论(0)
  • 2021-02-04 02:07

    Same issue here. The only workaround I've found is to use static library instead of framework.

    In case you are not able to use static library, you'd better file a bug report to Apple.

    0 讨论(0)
提交回复
热议问题