我创建了一个.xcframework
使用这个脚本:
FRAMEWORK_NAME=${PROJECT_NAME}
SCHEME=${PROJECT_NAME}
DISPLAY_NAME=${PROJECT_NAME}
echo "Archiving ${FRAMEWORK_NAME} for iOS simulator..." >> framework.log
xcodebuild archive \
-workspace "${PROJECT_DIR}/${FRAMEWORK_NAME}.xcworkspace" \
-scheme "${SCHEME}" \
-destination "generic/platform=iOS Simulator" \
-sdk iphonesimulator \
-archivePath "${PROJECT_DIR}/Archives/${FRAMEWORK_NAME}-iOS-Simulator" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
echo "Archiving ${FRAMEWORK_NAME} for iOS..." >> framework.log
xcodebuild archive \
-workspace "${PROJECT_DIR}/${FRAMEWORK_NAME}.xcworkspace" \
-scheme "${SCHEME}" \
-destination "generic/platform=iOS" \
-sdk iphoneos \
-archivePath "${PROJECT_DIR}/Archives/${FRAMEWORK_NAME}-iOS" \
SKIP_INSTALL=NO \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
echo "Creating the ${FRAMEWORK_NAME} XC Framework..." >> framework.log
xcodebuild -create-xcframework \
-framework "${PROJECT_DIR}/Archives/${FRAMEWORK_NAME}-iOS-Simulator.xcarchive/Products/Library/Frameworks/${DISPLAY_NAME}.framework" \
-framework "${PROJECT_DIR}/Archives/${FRAMEWORK_NAME}-iOS.xcarchive/Products/Library/Frameworks/${DISPLAY_NAME}.framework" \
-output "${PROJECT_DIR}/${DISPLAY_NAME}.xcframework"
但是,当我.xcframework
在另一个项目中导入时,我收到此错误:
dyld:找不到符号:_$s12ReachabilityAAC10ConnectionO11unavailableyA2DmFWC
引用自:/private/var/containers/Bundle/Application/A5315543-8323-4270-8D40-8BB1C940801C/App.app/Frameworks/Framework.framework/Framework
预计在:/private/var/containers/Bundle/Application/A5315543-8323-4270-8D40-8BB1C940801C/App.app/Frameworks/Reachability.framework/Reachability
在 /private/var/containers/Bundle/Application/A5315543-8323-4270-8D40-8BB1C940801C/App.app/Frameworks/Framework.framework/Framework
dyld:启动,加载依赖库DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/GPUTools框架/libglInterpose.dylib:/usr/lib/libMTLCapture.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
我在创建 an 时看到的每个示例都.xcframework
不会使用 an 存档.xcworkspace
,所以我认为我的问题必须与此有关。我需要存档,.xcworkspace
因为框架有自己的 Cocoapod 依赖项(Reachability
其中之一),但我正在集成的项目包含这些依赖项。
.xcframework
有没有人成功地从具有 Pod 依赖项的源代码创建了一个?