googlecast / CastVideos-ios

Reference iOS Sender w/ Framework API: CastVideos-ios application shows how to cast videos from an iOS device that is fully compliant with the Cast Design Checklist.
Apache License 2.0
193 stars 63 forks source link

ERROR ITMS-90087: "Unsupported Architectures" #21

Open Allan-Nava opened 7 years ago

Allan-Nava commented 7 years ago

I have this problem when I i try to upload the Archive Release.

ERROR ITMS-90087: "Unsupported Architectures. The executable for Sportube.app/Frameworks/GoogleCast.framework contains unsupported architectures '[x86_64, i386]'."

But I use a Run Script in Pre-Actions:

#!/bin/bash

# This script strips unused architectures from any frameworks embedded in an
# app bundle. It should be called from an Xcode project as a post-build step.

if [ -z "${TARGET_BUILD_DIR}" ]; then
  echo "This script should be invoked from an Xcode project."
  exit 1
fi

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

framework_dirs=($(find "${app_dir}" -type d -name '*.framework'))
for framework_dir in "${framework_dirs[@]}"; do
  framework_name=$(defaults read "${framework_dir}/Info.plist" CFBundleExecutable)

  if [ !-z "$framework_name" ]; then
    framework_path="${framework_dir}/${framework_name}"

    echo "Removing unused architectures from framework: ${framework_name}"

    slice_paths=()
    for arch in ${ARCHS}; do
      slice_path="${framework_path}_${arch}"
      lipo "${framework_path}" -extract "${arch}" -output "${slice_path}"
      slice_paths+=("${slice_path}")
    done

    lipo "${slice_paths[@]}" -create -output "${framework_path}_thinned"
    rm -f "${slice_paths[@]}"

    rm -f "${framework_path}"
    mv "${framework_path}_thinned" "${framework_path}"
  fi

done
NoRulesJustFeels commented 7 years ago

If you run the script manually do you see any errors?

Allan-Nava commented 7 years ago

When I try to run the script manually i got:

This script should be invoked from an Xcode project

And I use this guide to install GoogleCastFramework: https://developers.google.com/cast/docs/ios_sender_setup It is a dependency for jwplayer ios sdk

Allan-Nava commented 7 years ago

I change the bash script with:

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

And I use ionic build ios --release but when I try to upload in app store I have the same issue.

Thanks

NoRulesJustFeels commented 7 years ago

That is the recommended of stripping unwanted architecture. Do you have the same issue with other apps that don't use the Cast SDK?

Allan-Nava commented 7 years ago

@entertailion Cast SDK is dependency for jwplayer iOS SDK

NoRulesJustFeels commented 7 years ago

We don't have any other developers who are having this issue. There must be something particular about your apps dependencies that might be causing an issue with stripping the architectures. Have you reached out to the jwplayer team?

Allan-Nava commented 7 years ago

I know but the errors are:

ERROR ITMS-90087: "Unsupported Architectures. The executable for Sportube.app/Frameworks/GoogleCast.framework contains unsupported architectures '[x86_64, i386]'."

ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Sportube.app/Frameworks/GoogleCast.framework/GoogleCast' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

ERROR ITMS-90125: "The binary is invalid. The encryption info in the LC_ENCRYPTION_INFO load command is either missing or invalid, or the binary is already encrypted. This binary does not seem to have been built with Apple's linker."

WARNING ITMS-90080: "The executable 'Payload/Sportube.app/Frameworks/GoogleCast.framework' is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables. For more information refer to Technical Q&A QA1788 - Building a Position Independent Executable in the iOS Developer Library."

I donwload the manually GoogleCastFramework SDK from https://developers.google.com/cast/downloads/GoogleCastSDK-Public-3.5.3-Release-ios.zip

When I try to install the app manually it works, but when I try to upload to store I get errrors.

NoRulesJustFeels commented 7 years ago

Just realized you are running this as a pre-build step. The script needs to run as a post build step.

Allan-Nava commented 7 years ago

Do I insert the script bash in Pre-Actions and Post-Actions for Archive Release?

@entertailion Still not working...

NoRulesJustFeels commented 7 years ago

The script needs to be invoked in the post actions.

Also, the way your are running the script from the command line won't work, because $ARCHS won't be set. It's set by Xcode. If you wanted to run it manually you'd have to set it to the list of architectures that your'e building for, minus the x86 one.

Allan-Nava commented 7 years ago

@entertailion I add in post-actions but when I try to upload in App Store still not working..

primeappsin commented 7 years ago

Having Same problem

ERROR ITMS-90087: "Unsupported Architectures. The executable for Sportube.app/Frameworks/GoogleCast.framework contains unsupported architectures '[x86_64, i386]'." ERROR ITMS-90209: "Invalid Segment Alignment. The app binary at 'Sportube.app/Frameworks/GoogleCast.framework/GoogleCast' does not have proper segment alignment. Try rebuilding the app with the latest Xcode version."

Any one can help plz?

fizcoder commented 6 years ago

Any joy with this issue?

iharkatkavets commented 5 years ago

My app didn't pass automatic Apple Review because it 'contains unsupported architectures '[x86_64, i386]'. Are there any updates? It would helpful to add any script to strict 'unsupported architectures' to the 'Setup for Developing with the Cast Application Framework (CAF) for iOS' page

anjaneesh commented 5 years ago

Opened a ticket to update to new unsupported architectures.

jonathanredford commented 2 years ago

Anyone have a solution for this issue? I'm still getting it in 2021...