IOS引入第三方衝突解決辦法

來源:互聯網
上載者:User

標籤:

最近項目組在做一些第三方功能的整合,不止一次的遇到第三方庫衝突的問題,需要將衝突部分進行手動移除.

一般第三方的.a支援不同平台,需要將各個平台的衝突的xxx.o刪除,才能解決引入衝突問題.

寫了一個簡單的指令碼,可以刪除衝突xxx.o,並且重建.a

參數${1}為與工程衝突的第三方功能的.a名稱

參數${2}為衝突的.o檔案名稱

#!/bin/shDEVICE_ARCHS=("armv7" "armv7s" "arm64" "i386" "x86_64")extra_count=${#DEVICE_ARCHS[@]}for((i=0;i<extra_count;i++));domkdir -p ${DEVICE_ARCHS[i]}donefor((j=0;j<extra_count;j++));do    echo ${DEVICE_ARCHS[j]}    lipo ${1}.a -thin ${DEVICE_ARCHS[j]} -output ${DEVICE_ARCHS[j]}/${1}_${DEVICE_ARCHS[j]}.a    cd ${DEVICE_ARCHS[j]} && ar xv ${1}_${DEVICE_ARCHS[j]}.a    rm -rf ${DEVICE_ARCHS[j]}/${1}_${DEVICE_ARCHS[j]}.a    rm ${2}.o    cd .. && ar rcs ${DEVICE_ARCHS[j]}/${1}_${DEVICE_ARCHS[j]}.a ${DEVICE_ARCHS[j]}/*.o    rm -rf ${DEVICE_ARCHS[j]}/*.odonerm ${1}.astring=‘‘for((j=0;j<extra_count;j++));dostring+=${DEVICE_ARCHS[j]}/${1}_${DEVICE_ARCHS[j]}.a‘ ‘donelipo -create ${string} -output ${1}.afor((i=0;i<extra_count;i++));dorm -rf ${DEVICE_ARCHS[i]}done

範例:

sh ./xxx.sh libX xxx

 執行完成後libX.a中的xxx.o會被移除

IOS引入第三方衝突解決辦法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.