我目前正在开发包含应用内购买的应用。 厌倦了必须在所有项目中复制粘贴相同的类文件,我决定创建一个静态库。
我在Web上关注了如何为IOS创建静态库的几个可用指南,但我似乎总是遇到问题。
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_NWStorePackage", referenced from:
objc-class-ref in StoreTableViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
arm64架构显示相同的错误
我链接了库,添加了头文件。更新了标头搜索路径,更新了框架路径。不知道我还能做什么...... 我使用了以下脚本。
# define output folder environment variable
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# 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}"
xcodebuild -target ${PROJECT_NAME} -configuration ${CONFIGURATION} -sdk iphonesimulator -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}"
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Create universal binary file using lipo
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/lib${PROJECT_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/lib${PROJECT_NAME}.a"
# Last touch. copy the header files. Just for convenience
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/include" "${UNIVERSAL_OUTPUTFOLDER}/"
答案 0 :(得分:0)
您是否检查过所有标题是否都复制到了正确的目录中(在您在应用程序设置的标题路径中指定的那个?)。
如果未生成标题,可能您错过了将标题添加到复制文件步骤。或者您没有复制标题构建阶段: