How to create a universal infrastructure in xcode6

I know how to create a framework in Xcode 5. But in Xcode 6 how to combine both the simulator structure and the device structure? When I try to merge, I get a code signing error. When I use lipo to combine both frameworks, I also get an error message.

Error: Command /bin/sh failed with exit code 65

+5
source share
2 answers

My decision is to create a universal framework in xcode6.

Follow these steps:

Step 1:

 Fileβ€”> New β€”> Project β€”> Framework & Library β€”> Next β€”> Product Name 

Step 2: Creating Custom Class Files

Step 3 :

 Target -> Build phase -> Headers, 

Makes all headers publicly available. Now create a simulator and device.

Step 4:

 File -> New -> Target -> iOS -> Other -> Aggrigate ->somename eg: framework 

Step 5:

 From Targets β€”> Custom aggregate target(Eg: Framework)β€”> Build Phaseβ€”> Add Run script 

Step 6: Add the following shell code to the run script

 /// UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal # make sure the output directory exists mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" # Step 1. Build Device and Simulator versions xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build # Step 2. Copy the framework structure to the universal folder cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/" # Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}" 

Step 7:

 Goto active scheme β€”> Custom aggregate β€”> Build 

Step 8: Now right-click the product framework in Xcode and click show in finder.

Check the "Debug-universal" folder and get a universal infrastructure.

+16
source

replace

 xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build 

from

 xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build 

clear assembly

0
source

Source: https://habr.com/ru/post/1206793/


All Articles