2016-10-19 63 views
1

我正在使用以下腳本從我的項目中刪除不支持的Architetures。腳本未映射在Xcode中存檔時添加框架

APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}" 

# This script loops through the frameworks embedded in the application and 
# removes unused architectures. 
find "$APP_PATH" -name '*.framework' -type d | while read -r FRAMEWORK 
do 
FRAMEWORK_EXECUTABLE_NAME=$(defaults read "$FRAMEWORK/Info.plist" CFBundleExecutable) 
FRAMEWORK_EXECUTABLE_PATH="$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME" 
echo "Executable is $FRAMEWORK_EXECUTABLE_PATH" 

EXTRACTED_ARCHS=() 

for ARCH in $ARCHS 
do 
echo "Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME" 
lipo -extract "$ARCH" "$FRAMEWORK_EXECUTABLE_PATH" -o "$FRAMEWORK_EXECUTABLE_PATH-$ARCH" 
EXTRACTED_ARCHS+=("$FRAMEWORK_EXECUTABLE_PATH-$ARCH") 
done 

echo "Merging extracted architectures: ${ARCHS}" 
lipo -o "$FRAMEWORK_EXECUTABLE_PATH-merged" -create "${EXTRACTED_ARCHS[@]}" 
rm "${EXTRACTED_ARCHS[@]}" 

echo "Replacing original executable with thinned version" 
rm "$FRAMEWORK_EXECUTABLE_PATH" 
mv "$FRAMEWORK_EXECUTABLE_PATH-merged" "$FRAMEWORK_EXECUTABLE_PATH" 

done 

當我生成項目,框架增加了「手動」,這意味着,沒有的CocoaPods,包括在腳本循環,你可以在此圖像中看到:

Build Output

但當歸檔項目,框架不包括腳本,看到這個圖像中:

Archive Output

任何人都可以幫忙嗎?謝謝!!

回答

0

最後,我解決了這個問題。確保您的框架也添加到「複製束資源」中。