Xcode10趟坑之路
https://www.jianshu.com/p/12558d39ba08
先默念別有太多坑啊
跑起來吧
結果沒有跑起來
1.第一個坑
Showing Recent Messages
:-1: Multiple commands produce ‘/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app‘:
1) Target ‘JMTAPP‘ has create directory command with output ‘/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app‘
2) That command depends on command in Target ‘JMTAPP‘: script phase “[CP] Copy Pods Resources”
1
英語不好,隱約中感覺是跟Pod有關系,但是抓住了output 和[CP] Copy Pods Resources關鍵字,摸索一番之後,得到了解決辦法
TARGETS --> Build Phases --> [CP] Copy Pods Resources --> Output Files 刪除 ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
2
結果如下:
3
好的接著跑
2.第二個坑
Showing Recent Messages
:-1: Multiple commands produce ‘/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app/Info.plist‘:
1) Target ‘JMTAPP‘ (project ‘JMTAPP‘) has copy command from ‘/Users/wanglei/Desktop/iosv2.1 2/JMTAPP/Info.plist‘ to ‘/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app/Info.plist‘
2) Target ‘JMTAPP‘ (project ‘JMTAPP‘) has process command with output ‘/Users/wanglei/Library/Developer/Xcode/DerivedData/JMTAPP-grwqpsineudpywaswwtdjudjpkwm/Build/Products/Debug-iphonesimulator/JMTAPP.app/Info.plist‘
字面意思,說是info.plist 文件重復了
兩種解決方案:
1 設置workspace
xcode -> file -> WorkSpace Settings ->BuildSystem -> 選擇 Legacy Build System
4
2 刪除info.plist 文件
TARGETS --> Build Phases --> Copy Bundle Resources --> 刪除info.plist
3.第三個坑
猶豫項目比較老,很多第三方庫不能用了
Pods/ObjectMapper/Sources/EnumOperators.swift:35:13: Invalid redeclaration of ‘<-‘
5
紅的報的我想哭
嘗試更新第三方庫試試
pod update ObjectMapper --verbose --no-repo-update
pod update HandyJSON --verbose --no-repo-update
4.第四個坑
ld: library not found for -lstdc++.6.0.9
linker command failed with exit code 1 (use -v to see invocation)
項目裏用了阿裏百川的反饋,用了這個依賴庫,
字面意思,缺失c++依賴庫,蘋果在XCode10和iOS12中移除了libstdc++這個庫,由libc++這個庫取而代之,
蘋果的官方解釋是libstdc++已經標記為廢棄有5年了,建議大家使用經過了llvm優化過並且全面支持C++11的libc++庫。
這個好解決,缺失庫,我就從xcode9裏面把這些庫復制過來。
Xcode -> 顯示包內容->Contents->Developer->Platforms->iPhoneOS.platform(模擬器是iPhoneSimulator.platform)->Developer->SDKS->iPhoneOS.sdk->usr->lib
然後真機運行,成功
5.第五個坑
繼續上面的第四個坑啊,真機運行是OK的,但是模擬器運行,編譯通過後卻崩潰了。
6
看得出錯提示說是.dylib與這個模擬器不符合。
這個問題,要麽在Xcode10裏面安裝iOS11的模擬器運行環境,要麽就是跟廠家聯系,進行升級。
更新
找到了Xcode10模擬器和真機運行的辦法了
1.將libstdc++_sim.zip解壓,放到目錄
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/lib/
將 libstdc++.dylib_sim.zip 解壓,放到目錄
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/
總結
趟坑之路先寫到這裏,期間也遇到了以前同事寫的代碼過於臃腫,Xcode10識別不出來的問題,這都是小問題,就不贅述了,報的錯誤如下,有這個相似經歷的,稍微修改一下就可以了。
The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
歡迎各位大佬,批評指正和建議。
作者:王壘iOS
鏈接:https://www.jianshu.com/p/12558d39ba08
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯系作者獲得授權並註明出處。
Xcode10趟坑之路