3

We have created one framework and integrated it in my one app. I am able to run and debug the app using this framework but i am receiving below error while submitting to the app store.

Please note that i am using xcode 6.3.

Error: 'Unsupported architecture', The executable for XYZ contains unsupported architecture '[x86_64, i386]'."

I have added below script in settings to Framework code while creating the
framework(Static library) to make it universal.

 **Options**


REVEAL_ARCHIVE_IN_FINDER=true

FRAMEWORK_NAME="${PROJECT_NAME}"

SIMULATOR_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${FRAMEWORK_NAME}.framework"

DEVICE_LIBRARY_PATH="${BUILD_DIR}/${CONFIGURATION}-iphoneos/${FRAMEWORK_NAME}.framework"



UNIVERSAL_LIBRARY_DIR="${BUILD_DIR}/${CONFIGURATION}-iphoneuniversal"

FRAMEWORK="${UNIVERSAL_LIBRARY_DIR}/${FRAMEWORK_NAME}.framework"


`Build Frameworks`

  xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphonesimulator -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator | echo

 xcodebuild -project ${PROJECT_NAME}.xcodeproj -sdk iphoneos -target ${PROJECT_NAME} -configuration ${CONFIGURATION} clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphoneos | echo

 #xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" | echo

#xcodebuild -target ${PROJECT_NAME} ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" | echo



 Create directory for universal


rm -rf "${UNIVERSAL_LIBRARY_DIR}"

mkdir "${UNIVERSAL_LIBRARY_DIR}"

mkdir "${FRAMEWORK}"



Copy files Framework


cp -r "${DEVICE_LIBRARY_PATH}/." "${FRAMEWORK}"



Make fat universal binary


lipo "${SIMULATOR_LIBRARY_PATH}/${FRAMEWORK_NAME}"     "${DEVICE_LIBRARY_PATH}/${FRAMEWORK_NAME}" -create -output     "${FRAMEWORK}/${FRAMEWORK_NAME}" | echo



 On Release, copy the result to desktop folder


if [ "${CONFIGURATION}" == "Release" ]; then
mkdir "${HOME}/Desktop/${FRAMEWORK_NAME}-${CONFIGURATION}-iphoneuniversal/"
cp -r "${FRAMEWORK}" "${HOME}/Desktop/${FRAMEWORK_NAME}-${CONFIGURATION}-    iphoneuniversal/"
fi



 If needed, open the Framework folder


if [ ${REVEAL_ARCHIVE_IN_FINDER} = true ]; then
if [ "${CONFIGURATION}" == "Release" ]; then
open "${HOME}/Desktop/${FRAMEWORK_NAME}-${CONFIGURATION}-iphoneuniversal/"
else
open "${UNIVERSAL_LIBRARY_DIR}/"
fi
fi

Can anyone please help me to create framework which i can debug (means run in simulator), run(in device) and also submit to the appstore.

Thanks in advance.

Nikh1414
  • 1,238
  • 2
  • 19
  • 35

2 Answers2

3

You can't use universal fat binaries with application uploaded to AppStore. If you want to upload with your framework, build it only for device.

Serhii Mamontov
  • 4,942
  • 22
  • 26
  • 1
    What if I want to release a universal framwork like others do which work on devices, app store and simulator? – narek.gevorgyan Nov 25 '15 at 11:31
  • Universal framework never bundled with applications which should be submitted to AppStore. You can try to use `lipo -remove arch_type` inside of script which should prepare application for upload to AppStore to remove binary slices for simulator (Apple just won't pass binaries with redundant architecture slices into AppStore) – Serhii Mamontov Nov 25 '15 at 11:41
  • Then how the frameworks like Parse.framework succeeded to build that it works everywhere? – narek.gevorgyan Nov 25 '15 at 12:00
  • 2
    That is good question which I would like to know too. On my own experience of framework distribution I can say what some customers tries to use universal binaries and Application Loader explicitly pointed to my framework binaries. Usually, to add dynamic framework it should be placed into `Embedded Frameworks` section, but _Parse_ doesn't do so in their simple project, so I'm curious on whether they use static library wrapped into `.framework` or not (if so, it will mean what Apple pass fat static libraries - which is also strange). – Serhii Mamontov Nov 25 '15 at 12:43
  • Yeah really don't know. So the question is still open. I've seen many other frameworks working like that so I guess there a way to avoid having framework user to run lipo command. – narek.gevorgyan Nov 25 '15 at 13:35
  • Has anyone discovered the answer to how Parse and others are accomplishing this? Is Apple, perhaps, exempting certain companies' universal frameworks from rejection based on simulator architectures during the iTunesConnect upload? – Japes Sep 15 '16 at 20:57
  • @Japes someone suggested me this [link](http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/) – niczm25 Feb 24 '17 at 06:46
0

You can still use your universal framework, but would have to strip unwanted architecture. i don't try i yet but, i found here a sample of the same problem with solution on striping unwanted architecures. here

niczm25
  • 169
  • 1
  • 2
  • 13