Unable to build the project on Xcode 12.2

I’ve updated to Xcode 12.2 on macOS big sur. Used the latest Comet library v.2.1.2

I get the following error:
Failed to build module ‘CometChatPro’ from its module interface; the compiler that produced it, ‘Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)’, may have used features that aren’t supported by this compiler, ‘Apple Swift version 5.3.1 (swiftlang-1200.0.41 clang-1200.0.32.8)’

Used 2.1.4-beta1 too… it gives the same error.

Hello @anupam,

Please update to v2.1.3 iOS SDK.
Also check for below things:

In your project build setting excluded architecture for any ios simulator SDK add there arm64 for debug and release and keep build active architecture for debug and release to yes.

If still you’re facing issue then we’ll take forward it over team viewer session.

Warm Regards,

Pushpsen Airekar

Thanks for the response… I tried that but ended up getting a ARCHS[@]: unbound variable

Command PhaseScriptExecution failed with a nonzero exit code

I suspect this is due to the fact that I was stripping architectures at runtime to reduce app size. Any resolutions for this.

Here’s the script we were running:

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

# remove unused architectures from embedded frameworks
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=()

    if [[ $FRAMEWORK == *"CometChatPro"* ]]; then
      echo "It's there!"
    #  continue
    #fi   

    echo "Hello $FRAMEWORK"


    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"
    
    fi
   

done

Hi Anupam,
Can you please reach out to us from your registered mail id on help@cometchat.com?
@pushpsen.airekar and our technical team will be happy to help you on this over a TeamViewer session.

Looking forward to hearing from you.

Regards,
Paarth from CometChat
Customer Success

1 Like

Thanks, guys for the help today. I managed to run it. Though when I run it with the old script enabled in build rules (to strip unused archs for reducing the app size as Pod is too large), it doesn’t archive or install on my device.

I don’t think this is directly relevant to CometChat, so I’ve posted it on StackOverflow. Maybe if you guys have an idea, I’d be happy to know.

I’ve got the same error when I set the Excluded Architectures for Debug to arm64 and Build Active Architecture Only to Yes. Were you able to solve it?

It works on the simulator. But doesn’t run on a physical device for me. Many people are facing this issue. I’ve just found a helpful link on the apple dev forum:

https://developer.apple.com/forums/thread/661521

https://developer.apple.com/forums/thread/128806

I’ve switched back to Xcode 12.0.1 for now.