Xcode6 Create iOS Universal Framework Library

Since upgrading to Xcode and iOS8, I had a problem creating a thick static library. There are some good instructions here and here , but I think that part of the first instructions and all other instructions are dated. The first instructions say that to use the Static iOS Framework , and the second instructions use the Cocoa Touch Static Library . Prior to Xcode6, I would use the Static iOS Framework , but now that they have renamed it to Cocoa Touch Framework , I'm not sure.

So, for beginners, which should I use to create a bold static library ? Is it a Cocoa Touch Framework ? Or Cocoa Touch Static Library ?

Cocoa Touch Framework

Cocoa Touch Static Library

Then I create a new cumulative goal:

Aggregate target

Then I create Run Script:


Run script


Here is the Run Script I am using (fully):

# This script is based on Jacob Van Order answer on apple dev forums https://devforums.apple.com/message/971277 # See also http://spin.atomicobject.com/2011/12/13/building-a-universal-framework-for-ios/ for the start # To get this to work with a Xcode 6 Cocoa Touch Framework, create Framework # Then create a new Aggregate Target. Throw this script into a Build Script Phrase on the Aggregate ###################### # 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 

But when I try to build, I get this message:

 fatal error: lipo: can't open input file: /Users/pdl/Library/Developer/Xcode/DerivedData/innerIDMobileLicense-blnxjfvoxnqfelftmzojgdwhvazk/Build/Products/Debug-iphonesimulator/innerIDMobileLicense.framework/innerIDMobileLicense (No such file or directory) 

That's right, there is no file! Please note that in the first image below is the Unix IdAirOpenCv executable file. Then view the second image and note that IdAirOpenCv does not exist.

This is what I'm used to seeing before the upgrade:

Old folder structure

This is what I have now:

New folder structure

According to the script, the Unix executable innerIDMobileLicense must be located in all three folders of the structure at the same level as the header and module folders.

Does anyone know what I'm doing wrong?

+5
source share
1 answer

fatal error: lipo: cannot open the input file: / Users / pdl / Library / Developer / Xcode / DerivedData / innerIDMobileLicense -blnxjfvoxnqfelftmzojgdwhvazk / Build / Products / Debug-iphonesimulator / innerIDMobileLicense.framework / innerIDMobileLicense) (There is no such file or

This lipo error that you received is most likely due to the fact that the containing directory does not exist.

The script is created when xcode does not have a framework project.

Lipo basically ties two binary assemblies for different architectures together to build a thick one.

So, for beginners, which should I use to create a thick static library? Is it a Cocoa Touch Framework? Or Cocoa Touch Static Library?

Or one will work. Lipo can link the binary inside the framework and a simple static library

What I did was create a static library project and a framework project. Define the static library target as a device or simulator (using sdk iphoneos or iphonesimulator. Add the Universal Framework script to the framework project to create a static library with a different sdk and place the live binary image in the framework. Headers to the framework project. The structure does not need to be compiled.

+2
source

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


All Articles