鍓嶈█锛氭湰绡囦富瑕佹槸璁茶В浠庢棤鍒版湁鐨剆dk寮€鍙戯紝浠ュ強瀵箂dk寮€鍙戣繃绋嬩腑閬囧埌鐨勯棶棰樿褰曪紝鏂逛究浠ュ悗閬囧埌鐩镐技闂鍙互杞绘澗瑙e喅銆傚鏈変笉瀵圭殑锛屾湡鏈涘ぇ瀹跺澶氭彁鍑?..鏈枃浼氫竴鐩存寔缁洿鏂?/p>
绗竴璁诧細杩樻槸鍏堜粠鏈€鍩虹鐨勫紑濮嬶紝鍒涘缓涓€涓紑鍙憇dk鐨勫伐绋嬶紝鏈€甯哥敤鐨勮繕鏄痜ramework銆?/h3>
璇存槑涓嬶紝鏈鍒涘缓鏄粨鍚堝疄闄呭紑鍙戞祦绋嬫潵鐨勶紝鍒涘缓demo璋冭瘯宸ョ▼锛屽皢涓昏鐨勫姛鑳藉啓鍦╢ramework閲岄潰锛屾渶缁堜氦浠榝ramework缁欏鎴枫€?/p>
涓€锛氭潵涓垵绾х増鏈殑锛屽彧鏈変竴涓猣ramework鐨勬儏鍐?/h6>
- 鍏堝湪妗岄潰鍒涘缓涓€涓┖鐨勬枃浠跺す锛岀敤鏉ユ斁demo鍜宖ramework
- 鍒涘缓涓€涓櫘鏅€氶€氱殑demo锛宒emo瀛樺偍浣嶇疆鏀惧湪鍒氬垰鍒涘缓鐨勬枃浠跺す閲岄潰
- 鏈€閲嶈鐨勶紝寮€濮嬪垱寤轰竴涓?code>闈欐€乫ramework
鍒涘缓濂藉悗锛屼綅缃拰demo骞崇骇銆傝繖鏍峰氨鏈変竴涓紑鍙戣皟璇昫emo锛屼竴涓墦鍖呯殑sdk銆傛垜杩欓噷鍒涘缓鐨刦ramework鍚嶇О鏄疓eneral銆?br>
鐐瑰嚮鎵撳紑General锛屾垜浠幓鐪嬬湅鏋勯€狅紝鏈sdk鍙敮鎸乮os绯荤粺锛屾墍浠ュ厛鎶妋ac_os鍏堝垹鎺夈€?code>products鏂囦欢鐩綍涓嬶紝鏀剧殑灏辨槸鎴戜滑鎯宠鐨刦ramework锛屾垜浠寮€鍙戦渶瑕佸垱寤虹殑绫伙紝灏辨斁鍦?code>General鏂囦欢涓嬨€?br>
鍐嶄慨鏀逛竴涓嬮厤缃弬鏁帮紝璇风Щ姝ョ浜岃锛宍鎵撳寘閰嶇疆鐨勫弬鏁癭
-
鎺ヤ笅鏉ュ湪General閲岄潰涓€涓被锛屾坊鍔犱竴涓柟娉曪紝娴嬭瘯涓?br>
瑕佹兂澶栭儴鑳借闂埌杩欎釜绫伙紝杩橀渶瑕佸皢person绫荤殑.h鏂囦欢
璁剧疆涓?code>public
-
灏?code>demo鍜?code>General鍏宠仈璧锋潵锛屾柟渚胯皟璇?code>Genera搴?/code>閲岄潰鐨勬柟娉?br>
杩欎釜鏃跺€欓渶瑕佹敞鎰忊殸锔忥紝鎴戜滑鍒涘缓鐨刣emo鍙槸涓€涓櫘閫氬伐绋嬶紝鏄棤娉曞拰鍏朵粬搴撳叧鑱旇捣鏉ョ殑锛岃繖涓椂鍊欐垜浠渶瑕佸垱寤轰竴涓?code>榛戠鎶€锛岄偅灏辨槸workspace
銆傛渶绠€鍗曠殑鍒涘缓鏂瑰紡灏辨槸pods锛屾槸涓嶆槸绐佺劧鎯冲埌浜嗮煒勶紝褰撴垜浠娇鐢╟ocopods鐨勬椂鍊欙紝宸ョ▼pods鍚庝細鍑烘潵涓€涓甫鏈墂orkspace鍚庣紑鐨勬枃浠躲€傞偅缁欓」鐩坊鍔燾ocopods锛屾垜灏变笉璇翠簡锛岀偣鍑诲甫鏈?code>workspace鍚庣紑鐨勬枃浠讹紝閲嶆柊鎵撳紑宸ョ▼
璇存槑涓嬶紝鏈鍒涘缓鏄粨鍚堝疄闄呭紑鍙戞祦绋嬫潵鐨勶紝鍒涘缓demo璋冭瘯宸ョ▼锛屽皢涓昏鐨勫姛鑳藉啓鍦╢ramework閲岄潰锛屾渶缁堜氦浠榝ramework缁欏鎴枫€?/p>
- 鍏堝湪妗岄潰鍒涘缓涓€涓┖鐨勬枃浠跺す锛岀敤鏉ユ斁demo鍜宖ramework
- 鍒涘缓涓€涓櫘鏅€氶€氱殑demo锛宒emo瀛樺偍浣嶇疆鏀惧湪鍒氬垰鍒涘缓鐨勬枃浠跺す閲岄潰
- 鏈€閲嶈鐨勶紝寮€濮嬪垱寤轰竴涓?code>闈欐€乫ramework
鍒涘缓濂藉悗锛屼綅缃拰demo骞崇骇銆傝繖鏍峰氨鏈変竴涓紑鍙戣皟璇昫emo锛屼竴涓墦鍖呯殑sdk銆傛垜杩欓噷鍒涘缓鐨刦ramework鍚嶇О鏄疓eneral銆?br>
鐐瑰嚮鎵撳紑General锛屾垜浠幓鐪嬬湅鏋勯€狅紝鏈sdk鍙敮鎸乮os绯荤粺锛屾墍浠ュ厛鎶妋ac_os鍏堝垹鎺夈€?code>products鏂囦欢鐩綍涓嬶紝鏀剧殑灏辨槸鎴戜滑鎯宠鐨刦ramework锛屾垜浠寮€鍙戦渶瑕佸垱寤虹殑绫伙紝灏辨斁鍦?code>General鏂囦欢涓嬨€?br>
鍐嶄慨鏀逛竴涓嬮厤缃弬鏁帮紝璇风Щ姝ョ浜岃锛宍鎵撳寘閰嶇疆鐨勫弬鏁癭
-
鎺ヤ笅鏉ュ湪General閲岄潰涓€涓被锛屾坊鍔犱竴涓柟娉曪紝娴嬭瘯涓?br>
瑕佹兂澶栭儴鑳借闂埌杩欎釜绫伙紝杩橀渶瑕佸皢person绫荤殑.h鏂囦欢
璁剧疆涓?code>public
-
灏?code>demo鍜?code>General鍏宠仈璧锋潵锛屾柟渚胯皟璇?code>Genera搴?/code>閲岄潰鐨勬柟娉?br> 杩欎釜鏃跺€欓渶瑕佹敞鎰忊殸锔忥紝鎴戜滑鍒涘缓鐨刣emo鍙槸涓€涓櫘閫氬伐绋嬶紝鏄棤娉曞拰鍏朵粬搴撳叧鑱旇捣鏉ョ殑锛岃繖涓椂鍊欐垜浠渶瑕佸垱寤轰竴涓?code>榛戠鎶€锛岄偅灏辨槸
workspace
銆傛渶绠€鍗曠殑鍒涘缓鏂瑰紡灏辨槸pods锛屾槸涓嶆槸绐佺劧鎯冲埌浜嗮煒勶紝褰撴垜浠娇鐢╟ocopods鐨勬椂鍊欙紝宸ョ▼pods鍚庝細鍑烘潵涓€涓甫鏈墂orkspace鍚庣紑鐨勬枃浠躲€傞偅缁欓」鐩坊鍔燾ocopods锛屾垜灏变笉璇翠簡锛岀偣鍑诲甫鏈?code>workspace鍚庣紑鐨勬枃浠讹紝閲嶆柊鎵撳紑宸ョ▼
鎵撳紑鍚庯紝杩欎釜鏃跺€欐墠鑳藉紑濮嬪叧鑱?General'锛屽湪宸﹁竟绌虹櫧澶勶紝鍙抽敭鐐瑰嚮Add Files to ...
锛岃繘鍏ュ悗锛屾坊鍔?code>General鐨勫伐绋嬫枃浠讹紝涓€瀹氳鍙栨秷鍕鹃€?code>copy item into groups folder
鐐瑰嚮'add'锛屾坊鍔犲悗锛岄噸鏂板洖鍒板伐绋嬶紝杩欎釜鏃跺€欎細鐪嬪埌General
宸茬粡鏉ュ埌浜嗘垜浠殑宸ョ▼椤圭洰涓簡銆傜湅涓€涓嬪伐绋嬬洰褰曪紝鏄笉鏄竴鏍风殑
杩涜鍒拌繖閲岋紝鎴戜滑鍙畬鎴愪簡涓€鍗婏紝鎺ヤ笅鏉ユ槸灏?code>General鐨?code>framework锛屽叧鑱斿埌demo閲岄潰銆傜偣鍑籨emo宸ョ▼鐨則arget锛屽湪frameworks,libraies,and Embedded content
閲岄潰娣诲姞锛岀偣鍑?code>General.framework,娣诲姞鍚?br>
娣诲姞瀹屾垚鍚庯紝杩橀渶瑕佹渶鍚庝竴姝ヨ缃紝灏唀mbed璁剧疆涓?code>Do Not Embed
绗簩璁?鎵撳寘閰嶇疆鐨勫弬鏁?/h3>
- 閰嶇疆鎴愰潤鎬佸簱锛屽湪bulild setting 閲岄潰淇敼銆?/li>
Mach-O Type 锛?璁剧疆涓篠tatic Library銆傝繖涓槸璁剧疆涓洪潤鎬佸簱
- 閰嶇疆Build Active Architecture銆傞€夋嫨NO锛岃〃绀轰笉浠呬粎鏋勫缓褰撳墠閫夋嫨璁惧鐨勬灦鏋?/li>
Build Active Architecture Only = NO
- 閰嶇疆 Strip Debug Symbols During Copy
Strip Debug Symbols During Copy 璁剧疆涓?NO锛屼笉鐒舵柇鐐逛笉浼氳蛋
- 璁剧疆Excluded Architecture锛堟帓闄ゆ灦鏋勶級
General -> XXSDK -> Build Settings -> Excluded Architectures -> Release -> 娣诲姞閫夋嫨Any iOS Simulator SDK -> 娣诲姞arm64
鍥犱负Xcode12浠ュ悗锛屾瀯寤烘ā鎷熷櫒鐨勫簱涔熼粯璁ゆ敮鎸乤rm64鏋舵瀯锛岃繖灏嗕細瀵艰嚧鐪熸満鍜屾ā鎷熷櫒鐨勫簱鍚堝苟鏃跺け璐ワ紙fatal error: xx1/XLTestFrame and xx2/XLTestFrame have the same architectures (arm64) and can't be in the same fat output file锛夛紝鎶ラ敊鍘熷洜锛氱湡鏈哄簱鍜屾ā鎷熷櫒搴撻兘鍖呭惈arm64鏋舵瀯
绗笁璁诧細鏈夋椂鎴戜滑鎯崇煡閬撳綋鍓嶇殑sdk鍖咃紝鏀寔鍦ㄥ摢浜涙墜鏈轰笂杩愯锛岃繖鏃跺氨闇€瑕佸幓鏌ョ湅銆傛煡鐪媠dk 鍖?鏀寔鐨勮澶囩増鏈?/h3>
- 鎵撳紑缁堢
cd 鎶婃闈笂鐨刦ramework鎷栬繘鏉ュ惂
Mach-O Type 锛?璁剧疆涓篠tatic Library銆傝繖涓槸璁剧疆涓洪潤鎬佸簱
Build Active Architecture Only = NO
Strip Debug Symbols During Copy 璁剧疆涓?NO锛屼笉鐒舵柇鐐逛笉浼氳蛋
General -> XXSDK -> Build Settings -> Excluded Architectures -> Release -> 娣诲姞閫夋嫨Any iOS Simulator SDK -> 娣诲姞arm64
鍥犱负Xcode12浠ュ悗锛屾瀯寤烘ā鎷熷櫒鐨勫簱涔熼粯璁ゆ敮鎸乤rm64鏋舵瀯锛岃繖灏嗕細瀵艰嚧鐪熸満鍜屾ā鎷熷櫒鐨勫簱鍚堝苟鏃跺け璐ワ紙fatal error: xx1/XLTestFrame and xx2/XLTestFrame have the same architectures (arm64) and can't be in the same fat output file锛夛紝鎶ラ敊鍘熷洜锛氱湡鏈哄簱鍜屾ā鎷熷櫒搴撻兘鍖呭惈arm64鏋舵瀯
- 鎵撳紑缁堢
cd 鎶婃闈笂鐨刦ramework鎷栬繘鏉ュ惂
2.1 浣跨敤 lipo -info 鍏抽敭瀛楁煡鐪媐ramework,鍚庨潰鍔犱笂浣爁ramework鍚嶅瓧
lipo -info frameworkName
2.2 浣跨敤 lipo -info 鍏抽敭瀛楁煡鐪?a鐨勯潤鎬佸簱锛屽悗闈㈠姞涓婂叏绉?/p>
lipo -info frameworkName.a
- 1 绀轰緥 opencv2.framework
cd /Users/zhangsan/Desktop/opencv2.framework
lipo -info opencv2
3.2 绀轰緥 LibFaceRecognition.a
cd /Users/zhangsan/Desktop/MSRecordAVSDK
lipo -info LibFaceRecognition.a
鏍规嵁鏌ヨ鍑烘潵鐨勬寚浠ら泦锛屾煡鐪嬪搴旀敮鎸佺殑璁惧
iOS璁惧鏀寔鐨勬寚浠ら泦
armv6:
銆€銆€iPhone, iPhone 3G, iPod 1G/2G
armv7:
銆€銆€iPhone 3GS, iPhone 4, iPhone 4S, iPod 3G/4G/5G, iPad, iPad 2, iPad 3, iPad Mini
armv7s锛?
銆€銆€ iPhone 5, iPhone 5c, iPad 4
arm64:
銆€銆€iPhone X锛宨Phone 8(Plus)锛宨Phone 7(Plus)锛宨Phone 6(Plus)锛宨Phone 6s(Plus), iPhone 5s, iPad Air(2), Retina iPad Mini(2,3)
arm64e:
銆€銆€iPhone XS\XR\XS Max
绯荤粺榛樿鐨勬寚浠ら泦锛?
路 $(SDKROOT)=iphoneos: armv7 arm64
路 $(SDKROOT)=iphonesimulator: i386 x86_64
路 $(SDKROOT)=macosx: x86_64
璁剧疆浣犵殑sdk鏀寔鐨勭増鏈?/h6>
濡傛灉浣犳兂璁剧疆浣犵殑sdk鏀寔鐨勭増鏈负armv7 arm64
锛屼綘闇€瑕佸皢浣犵殑绯荤粺鐗堟湰璁剧疆涓?code>ios8銆?br>
濡傛灉浣犳兂璁剧疆浣犵殑sdk鏀寔鐨勭増鏈负arm64
锛屼綘闇€瑕佸皢浣犵殑绯荤粺璁剧疆涓?code>ios11銆?/p>
绗洓璁诧細鐞嗚ВBuild Active Architecture Only
寰€寰€鎴戜滑鍦ㄦ墦鍖卻dk鐨勬椂鍊欙紝浼氳€冭檻鍏跺吋瀹规€э紝鎻愪緵缁欏鎴风殑鐗堟湰锛岃鍏煎锛屼笉鑳芥姤閿欍€傚摢鎬曟槸鍔熻兘涓嶆敮鎸佽繖涓増鏈紝浣嗘槸鑷冲皯缂栬瘧浣犲緱杩囷紝鐒跺悗鍐嶈€冭檻鎬庝箞閬垮紑浣庣郴缁熺増鏈殑銆?br>
Build Active Architecture Only
涓€鍏辨湁涓や釜bool鍊硷紝YES
銆?code>NO銆備粬浠殑鍚箟鍒嗗埆鏄細
璁剧疆涓簓es锛屾槸鍙紪璇戝綋鍓嶇殑architecture鐗堟湰锛屾槸涓轰簡缂栬瘧閫熷害鏇村揩銆?
涓€鑸垜浠湪release鐜涓嬭繖鏍疯缃€?
鑰岃缃负no鏃讹紝绯荤粺浼氱紪璇戞墍鏈塧rchitecture涓嬬殑鐗堟湰
涓€鑸垜浠湪debug鐜涓嬭繖鏍疯缃€?
鎵€浠ユ垜浠緱璁剧疆涓篘O锛屽悜涓嬪吋瀹逛綘鎵€鏈夋敮鎸佺殑鐗堟湰銆傛垜鍦ㄧ浜岃鐨勬椂鍊欙紝璁茶В浜嗘€庝箞璁剧疆鏀寔
绗簲璁?寮€鍙戜腑閬囧埌鐨勶紝瑙夊緱鍙互璁板綍涓嬬殑鐭ヨ瘑鐐?/h3>
1. 閰嶇疆浠g爜閫夋嫨鎬х紪璇?/h5>
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
// iOS9浠ュ悗 鎵ц杩欓噷
#else
//ios9浠ュ墠 鎵ц杩欓噷
#endif
2. 鎵撳寘闈欐€佸簱鏃讹紝xib涓嶄細琚紪璇戞垚nib锛岃€屽鏋滀綘鐩存帴鍦ㄤ富椤圭洰涓娇鐢▁ib锛岀紪璇戠殑鏃跺€欏氨浼氭妸xib缂栫▼nib銆傚洜姝ら渶瑕佹垜浠墜鍔ㄦ妸xib缂栫▼nib
浣跨敤鍛戒护琛岋細ibtool --errors --warnings --output-format human-readable-text --compile /Users/**/Desktop/ViewController.nib /Users/**/Desktop/ViewController.xib
3. 鏌ヨ涓€涓簱锛屾槸闈欐€佸簱杩樻槸鍔ㄦ€佸簱
-
棣栧厛鍦ㄥ伐绋嬩腑鎵惧埌褰撳墠搴擄紝榧犳爣鍙抽敭show in finder
锛屾壘鍒版枃浠剁洰褰?br>
鎵撳紑缁堢锛岃緭鍏ユ煡璇㈠懡浠?br>
cd 灏嗗綋鍓嶇殑搴撴嫋杩涙潵
file 搴撳悕
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 90000
// iOS9浠ュ悗 鎵ц杩欓噷
#else
//ios9浠ュ墠 鎵ц杩欓噷
#endif
2. 鎵撳寘闈欐€佸簱鏃讹紝xib涓嶄細琚紪璇戞垚nib锛岃€屽鏋滀綘鐩存帴鍦ㄤ富椤圭洰涓娇鐢▁ib锛岀紪璇戠殑鏃跺€欏氨浼氭妸xib缂栫▼nib銆傚洜姝ら渶瑕佹垜浠墜鍔ㄦ妸xib缂栫▼nib
浣跨敤鍛戒护琛岋細ibtool --errors --warnings --output-format human-readable-text --compile /Users/**/Desktop/ViewController.nib /Users/**/Desktop/ViewController.xib
3. 鏌ヨ涓€涓簱锛屾槸闈欐€佸簱杩樻槸鍔ㄦ€佸簱
-
棣栧厛鍦ㄥ伐绋嬩腑鎵惧埌褰撳墠搴擄紝榧犳爣鍙抽敭
show in finder
锛屾壘鍒版枃浠剁洰褰?br> 鎵撳紑缁堢锛岃緭鍏ユ煡璇㈠懡浠?br>
cd 灏嗗綋鍓嶇殑搴撴嫋杩涙潵
file 搴撳悕
绀轰緥锛?AFNetworking.framework
cd /Users/***/AFNetworking.framework
file AFNetworking
杈撳嚭
current ar archive:璇存槑鏄潤鎬佸簱
Mach-0 dynamically锛氳鏄庢槸鍔ㄦ€佸簱
4. 鏌ヨ鍔ㄦ€佸簱鏄惁绛惧悕
cd 灏嗗綋鍓嶇殑搴撴嫋杩涙潵
codesign -dv 搴撳悕
绀轰緥锛歓RTC.framework
cd /Users/***/ZRTC.framework
codesign -dv ZRTC
杈撳嚭锛?/p>
Signature size=4895,Signed Time=Mar 2, 2022 at 10:14:14 AM 锛氳鏄庡凡绛惧悕
code object is not signed at all 锛?璇存槑娌℃湁绛惧悕
5. 鍒╃敤鑴氭湰鑷姩蹇界暐x86妯℃嫙鍣ㄦ灦鏋?/h5>
鑳屾櫙锛氫负浜嗘柟渚挎ā鎷熷櫒杩愯缂栬緫锛屼竴鑸垜浠殑framework浼氬寘鍚玜rm64鍜寈86鏋舵瀯锛屼絾鏄痑rchive鎵撳寘涓婃灦鏃讹紝浼氭姤閿欙紝涓嶅厑璁稿彂甯冿紝闇€瑕佸皢x86鐨勬灦鏋勭粰鍒犻櫎鎺夈€傝繖涓椂鍊欏氨鍙互鍒╃敤xcode鑷甫鐨勮剼鏈伐鍏?/p>
- 鍏堝垱寤鸿剼鏈紪杈戝櫒
Target -> build Phaes -> + -> New Run Script Phases
- 鍦ㄧ紪杈戝櫒閲岄潰杈撳叆鑴氭湰浠g爜
#!/bin/sh
# Strip invalid architectures
strip_invalid_archs() {
binary=""
echo "current binary ${binary}"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
if [ -f "$binary" ]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
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"
strip_invalid_archs "$FRAMEWORK_EXECUTABLE_PATH"
done
鎶ラ敊鏁寸悊锛屽紑鍙戜腑閬囧埌鐨勬姤閿欙紝鎸佺画鏇存柊....
1. 寮曞叆鐨勫簱锛岃缃殑embed
bitcode_strip /Users/xx/Library/Developer/Xcode/DerivedData/xxx-
ageraaywrmdjawgxyquufnhwqqnf/Build/Products
/Debug-iphoneos/xxx.framework/xxx: /Applications/Xcode.app/Contents
/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip exited with 1
鑳屾櫙锛氫负浜嗘柟渚挎ā鎷熷櫒杩愯缂栬緫锛屼竴鑸垜浠殑framework浼氬寘鍚玜rm64鍜寈86鏋舵瀯锛屼絾鏄痑rchive鎵撳寘涓婃灦鏃讹紝浼氭姤閿欙紝涓嶅厑璁稿彂甯冿紝闇€瑕佸皢x86鐨勬灦鏋勭粰鍒犻櫎鎺夈€傝繖涓椂鍊欏氨鍙互鍒╃敤xcode鑷甫鐨勮剼鏈伐鍏?/p>
Target -> build Phaes -> + -> New Run Script Phases
#!/bin/sh
# Strip invalid architectures
strip_invalid_archs() {
binary=""
echo "current binary ${binary}"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
stripped=""
for arch in $archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
if [ -f "$binary" ]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
fi
fi
done
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
}
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"
strip_invalid_archs "$FRAMEWORK_EXECUTABLE_PATH"
done
bitcode_strip /Users/xx/Library/Developer/Xcode/DerivedData/xxx-
ageraaywrmdjawgxyquufnhwqqnf/Build/Products
/Debug-iphoneos/xxx.framework/xxx: /Applications/Xcode.app/Contents
/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/bitcode_strip exited with 1
瑙e喅鏂规锛岃缃负 Do Not Embed
锛屼富瑕佹槸鍥犱负褰撳墠framework
鏄釜闈欐€佸簱銆傚鏋滄槸鍔ㄦ€佸簱锛岄偅涔堝氨闇€瑕佽缃负Embed & Sign
锛岀洰鍓?code>appstore鏄彲浠ヤ笂绾垮姩鎬佸簱锛屼絾鏄繀椤婚厤缃簱鐨勭鍚嶅拰app鐨勭鍚嶄竴鑷?br>
2. xcode15 杩愯ios12绯荤粺宕╂簝
dyld: Library not loaded: /System/Library/Frameworks/MetricKit.framework/MetricKit
Referenced from: /var/containers/Bundle/Application/B5F01DF6-99FE-44C9-A4FB-C4D781FCAD66/ZKJAIRecord.app/ZKJAIRecord
Reason: image not found
宕╂簝鍒嗘瀽锛氱敱浜嶮etricKit搴撴槸鍦↖os13绯荤粺鎵嶅嚭鐜扮殑锛屾墍浠ヤ細宕╂簝銆?br> 瑙e喅鍔炴硶锛氬鏋滄病鏈変娇鐢紝灏卞垹闄ゆ帀璇ュ簱銆傚鏋滆浣跨敤锛岄偅涔堝氨闇€瑕佹敼鏈€浣庢敮鎸佺増鏈€?/p>
3. framework寮€鍙戞椂锛屽穿婧冨埌category
*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[__NSCFConstantString zkj_toTest]: unrecognized selector sent to instance 0x10455c4b8'
宕╂簝鍒嗘瀽锛?br> 鑻规灉瀹樻柟Q&A涓婃湁杩欎箞涓€娈佃瘽锛?/p>
The "selector not recognized" runtime exception occurs due to an issue between the implementation of standard UNIX static libraries, the linker and the dynamic nature of Objective-C. Objective-C does not define linker symbols for each function (or method, in Objective-C) - instead, linker symbols are only generated for each class. If you extend a pre-existing class with categories, the linker does not know to associate the object code of the core class implementation and the category implementation. This prevents objects created in the resulting application from responding to a selector that is defined in the category.
缈昏瘧杩囨潵锛屽ぇ姒傛剰鎬濆氨鏄疧bjective-C鐨勯摼鎺ュ櫒骞朵笉浼氫负姣忎釜鏂规硶寤虹珛绗﹀彿琛紝鑰屾槸浠呬粎涓虹被寤虹珛浜嗙鍙疯〃銆傝繖鏍风殑璇濓紝濡傛灉闈欐€佸簱涓畾涔変簡宸插瓨鍦ㄧ殑涓€涓被鐨勫垎绫伙紝閾炬帴鍣ㄥ氨浼氫互涓鸿繖涓被宸茬粡瀛樺湪锛屼笉浼氭妸鍒嗙被鍜屾牳蹇冪被鐨勪唬鐮佸悎璧锋潵銆傝繖鏍风殑璇濓紝鍦ㄦ渶鍚庣殑鍙墽琛屾枃浠朵腑锛屽氨浼氱己灏戝垎绫婚噷鐨勪唬鐮侊紝杩欐牱鍑芥暟璋冪敤灏卞け璐ヤ簡銆?br> 瑙e喅鏂规硶
瑙e喅鏂规硶锛屽湪Other Linker Flags閲屽姞涓婃墍闇€鐨勫弬鏁帮紝鐢ㄥ埌鐨勫弬鏁颁竴鑸湁浠ヤ笅3涓細
-ObjC
: 閾炬帴鍣ㄤ細鎶婇潤鎬佸簱涓墍鏈夌殑Objective-C绫诲拰鍒嗙被閮藉姞杞藉埌鏈€鍚庣殑鍙墽琛屾枃浠朵腑锛岃櫧鐒惰繖鏍峰彲鑳戒細鍥犱负鍔犺浇浜嗗緢澶氫笉蹇呰鐨勬枃浠惰€屽鑷村彲鎵ц鏂囦欢鍙樺ぇ-all_load
: 浼氳閾炬帴鍣ㄦ妸鎵€鏈夋壘鍒扮殑鐩爣鏂囦欢閮藉姞杞藉埌鍙墽琛屾枃浠朵腑锛屼絾鏄崈涓囦笉瑕侀殢渚夸娇鐢ㄨ繖涓弬鏁帮紒鍋囧浣犱娇鐢ㄤ簡涓嶆涓€涓潤鎬佸簱鏂囦欢锛岀劧鍚庡張浣跨敤浜嗚繖涓弬鏁帮紝閭d箞浣犲緢鏈夊彲鑳戒細閬囧埌ld: duplicate symbol閿欒锛屽洜涓轰笉鍚岀殑搴撴枃浠堕噷闈㈠彲鑳戒細鏈夌浉鍚岀殑鐩爣鏂囦欢锛屾墍浠ュ缓璁湪閬囧埌-ObjC澶辨晥鐨勬儏鍐典笅浣跨敤-force_load鍙傛暟銆?/p>-force_load
: 鎵€鍋氱殑浜嬫儏璺?all_load鍏跺疄鏄竴鏍风殑锛屼絾鏄?force_load闇€瑕佹寚瀹氳杩涜鍏ㄩ儴鍔犺浇鐨勫簱鏂囦欢鐨勮矾寰勶紝杩欐牱鐨勮瘽锛屼綘灏卞彧鏄畬鍏ㄥ姞杞戒簡涓€涓簱鏂囦欢锛屼笉褰卞搷鍏朵綑搴撴枃浠剁殑鎸夐渶鍔犺浇銆?/p>
鎵惧埌Build settings->Linking->Other Linker Flags锛屽皢姝ゅ睘鎬т慨鏀规垚-ObjC
3. framework寮€鍙戞椂锛岀紪璇戞姤閿?/h4>
Undefined symbols:
Linker command failed with exit code 1 (use -v to see invocation)
Undefined symbols:
Linker command failed with exit code 1 (use -v to see invocation)
闂鎺掓煡鍒嗘瀽锛屾槸鍥犱负鍦ㄥ紑鍙慺ramework鏃讹紝涓讳綋璇█鏄疧C锛屼絾鏄祵鍏ヤ簡swift璇█绫汇€傚湪demo灞備篃鏄疧C璇█妗嗘灦锛屽鑷寸殑銆?/p>
瑙e喅鍔炴硶锛氬湪App宸ョ▼閲岄潰锛屾柊寤轰竴涓猻wift绫伙紝绌烘枃浠跺嵆鍙紝涓嶉渶瑕佷换浣曚唬鐮併€傚啀娆$紪杈戝畬缇庤В鍐炽€?/p>
PS
: 涓€鑸嚭鐜拌繖涓棶棰橈紝杩樻湁灏辨槸鍦‵ramework寮曠敤浜嗙涓夋柟绫伙紝浣嗘槸鍦ㄥ閮ˋpp鏈紩鐢ㄨ绫?/h6>
4. Xcode鍗囩骇15
鎶ラ敊锛?code>Sandbox: rsync.samba(38011) deny(1) file-write-create
浣跨敤 Xcode15 鏂板缓椤圭洰鍚庯紝pod 寮曞叆閮ㄥ垎绗笁鏂逛細鎶ヤ笂闈㈢殑閿欒
瑙e喅鍔炴硶锛欱uild Settings 鎼滅储 sandbox锛屾妸 Build Options
涓殑 User Script Sandboxing
鏀逛负 NO
5. Pod瀵煎叆涓夋柟搴撳悗锛屼娇鐢ㄦ椂宕╂簝
鍦ㄥ紑鍙慺ramework鏃讹紝鐢ㄥ埌浜嗕笁鏂?code>masonry锛孉pp宸ョ▼涓紩鐢ㄨframework锛宲od閲屾坊鍔?masonry',缁撴灉杩愯鏃讹紝宕╂簝鍦ㄤ簡masonry鐨勬柟娉曚笂銆?/p>
瑙e喅鍔炴硶锛欱uild Settings 鎼滅储 linker锛屽湪 Build setting
涓殑 Other Linker Flags
,娣诲姞 $(inherited)
閫氳繃CocoaPods闆嗘垚鐨勯」鐩紝
$(inherited)
灏嗕細鍖呭惈Pods.xcodeproj涓殑閰嶇疆銆俰nherited 鏄户鎵跨殑鎰忔€濄€?/p>
SWift 寮€鍙慺ramework,閬囧埌鐨勯棶棰橈紝鍙傝€冮摼鎺ュ涓?/h3>
swift SDK寮€鍙戦亣鍒扮殑闂