1. 鏈接器崩潰(最優(yōu)先處理)
現(xiàn)象:ld: Assertion?failed: (it?!= _dylibToOrdinal.end()), function dylibToOrdinal
原因:Xcode?26/16+ 與舊鏈接器?-ld_classic?不兼容。
處理:在主 App 的?Other Linker Flags?里刪掉?-Wl?和?-ld_classic,只留?$(inherited),然后 Clean + 再 Archive。
2. Swift 庫路徑不存在
現(xiàn)象:directory?not found for .../Metal.xctoolchain/usr/lib/swift/iphoneos?或 NotificationService 報(bào) swiftCompatibility?相關(guān)錯(cuò)。
原因:Pods 的 xcconfig 里用了?${TOOLCHAIN_DIR},在部分環(huán)境會(huì)指向不存在的 Metal 工具鏈。
處理:
給主 App 和 NotificationService 的?Library Search Paths?增加:
$(DEVELOPER_DIR)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/$(PLATFORM_NAME)
在?Podfile?的?post_install?里把上述 TOOLCHAIN_DIR 路徑替換成 DEVELOPER_DIR 的路徑(文檔里有完整腳本)。
若該 Mac?不跑?pod install,就按文檔里「方式 B」直接改 Pods 下的?xcconfig 和 frameworks.sh。
3. Category / 重復(fù)符號(hào)
現(xiàn)象:conflicts with same?method from?another category?或?overrides method from class,然后鏈接失敗或 dylibToOrdinal。
原因:同一方法在主類和 Category、或兩個(gè) Category 里都有實(shí)現(xiàn)。
處理:只保留一處實(shí)現(xiàn);若從主類刪實(shí)現(xiàn),一定要在對(duì)應(yīng)?.h?里保留聲明。本工程里改過的有:UIView+UL、ULSSZipArchive、ULIMService、ULCommonTag、ULHomeFavoriteListViewController、ULRadioDramaAlbumDetailController、ULRadioDramaCVListController(文檔里有表格)。
4. 其他?Mac 上 Jenkins 的推薦順序
先去掉?-ld_classic,Clean 后 Archive。
若還有?Swift 路徑或 NotificationService 鏈接問題,按文檔做?Library Search Paths?+ Podfile/post_install(或手動(dòng)改 Pods)。
若還有 “conflicts / overrides” 的 ld?警告,按文檔第三節(jié)和表格逐處去重并補(bǔ)聲明。
確保 Jenkins?打包前執(zhí)行?pod install,且 Xcode 版本/路徑一致。