我正在创建一个小SDK,我想发布一个Foo.framework。 我所做的是以下内容:
1-创建项目框架。
2-添加我的代码。
3-添加agregator。
在Agregator Build Phases中,我添加了这个运行脚本
#!/bin/sh
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 ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
//Step 2. Copy the framework structure (from iphoneos build) 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 4. Convenience step to copy the framework to the project's directory
cp -R "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework" "${PROJECT_DIR}"
//Step 5. Convenience step to open the project's directory in Finder
open "${PROJECT_DIR}"
然后我构建了Agregator并获得了Foo.framwork 我的问题是,为了能够在另一个应用程序中使用该框架,我应该:
第1步 - 将框架拖放到我的项目中。
步骤2-并将其添加到嵌入式二进制文件中。
如果我不执行第2步,则会出现此错误
dyld: Library not loaded: @rpath/Foo.framework/Foo
Referenced from: /private/var/mobile/Containers/Bundle/Application/00A2E4FD-23F4-43E8-AA85-505785A4FF16/foo.app/foo
Reason: image not found
如果我只想将框架拖到我的项目中,我该怎么办?
(换句话说,只将它添加到Link Binary with Library)以使其易于集成。
在此先感谢。
答案 0 :(得分:0)
对于面临此类问题的所有人,解决方案就在这里。 只需按照这些说明构建一个Framework
即可