> ## Documentation Index
> Fetch the complete documentation index at: https://cometchat-22654f5b-docs-angular-v5-docs-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Publishing App On App Store

> Prepare and publish your CometChat iOS app on the App Store with required capabilities and release checks.

<Accordion title="AI Integration Quick Reference">
  Key steps to publish your CometChat iOS app:

  1. Add a **Run Script Phase** in Build Phases to strip simulator architectures
  2. Use the appropriate script for your Xcode version (11.4 vs 11.5+)
  3. The script removes unused architecture slices from embedded frameworks
  4. For beta SDK versions, update `CFBundleShortVersionString` in `CometChatSDK.framework/Info.plist` (remove "beta" from version string)
</Accordion>

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-angular-v5-docs-update/p231kj41ev7n6i2F/images/65f3ab00-1623200383-3d0543d0dd698901cf7b25d696693e42.png?fit=max&auto=format&n=p231kj41ev7n6i2F&q=85&s=fc18f245adbdb597be4dbe3e1813243d" width="644" height="217" data-path="images/65f3ab00-1623200383-3d0543d0dd698901cf7b25d696693e42.png" />
</Frame>

This guide helps you to push and publish your App on iTunes.

If you want to submit your app to the app store, you have to cut off the simulator related codebase from the framework.

Go under the Project Targets --> `Build Phases` --> Click on \[+] Button --> `New Run Script Phase`.

<Frame>
  <img src="https://mintcdn.com/cometchat-22654f5b-docs-angular-v5-docs-update/T0aTXbhtWmYnVWC0/images/b19ca038-1623200384-750d31a49886af738019d6932ec05cd9.png?fit=max&auto=format&n=T0aTXbhtWmYnVWC0&q=85&s=58f7cb89772701de43ed25f307fe90f6" width="2442" height="732" data-path="images/b19ca038-1623200384-750d31a49886af738019d6932ec05cd9.png" />
</Frame>

Then, add the below script in the new `Run Script`.

If you are using `Xcode 11.4` then please use the below script

<Tabs>
  <Tab title="Ruby">
    ```ruby theme={null}
    # This script loops through the frameworks embedded in the application 
    # and removes unused architectures.
    find "${TARGET_BUILD_DIR}_${WRAPPER_NAME}" -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"
        for arch in $(lipo -archs $FRAMEWORK_EXECUTABLE_PATH); do
            if ! printf '%s\n' ${ARCHS[@]} | egrep -q "^$arch$"; then
                lipo -remove $arch "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH" 
            fi
        done
    done
    ```
  </Tab>
</Tabs>

If you are using `Xcode 11.5` or higher then please use the below script

<Tabs>
  <Tab title="Ruby">
    ```ruby theme={null}
    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=()

        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
    ```
  </Tab>
</Tabs>

This above scripts will remove all the unnecessary slices from the framework, so you'll be able to submit your app via iTunesConnect, without any issues.

<Warning>
  If you are pushing your App on iTunes with the beta version of CometChat SDK then you need to the value of **CFBundleShortVersionString** by opening the CometChatSDK.framework in the finder, open the\*\* info.plist \*\*file and set the value of **CFBundleShortVersionString** by removing the beta word from the version and then try compiling your App Project.
</Warning>
