- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.xcodebuild
編譯沒有通過
私有庫中依賴私有庫
本地驗證善茎、遠端驗證
pod lib lint HYVideoPlayerKit.podspec --sources=索引倉庫地址,https://github.com/CocoaPods/Specs.git --verbose --allow-warnings
Unable to find a specification for `HYVideoPlayerKit` depended upon by `HYEditVideoKit`
Framework not found EasyDarkMode
刪除重新編譯
Build Settings 找到Other Linker Flags中找到你的那個XXXX框架然后刪除省有,重新編譯就可以成功骗爆。
異常:XCode編譯出錯異常:ld: framework not found Kernel clang: error: linker command failed with e.......
解決辦法:
Targets->Build Setting->Linking->Match-o-Type ,修改為Static Library,再次編譯,編譯成功枉昏。
https://blog.csdn.net/qq_40697071/article/details/99055070
Command /bin/sh failed with exit code 1
本地腳本編譯出錯
- 選中項目 -> TARGETS->Build Phases-> “Bundle React Native code and images”
2.勾選 “Run script only when installing”
“CFBundleExecutable” is not specified
“CFBundleExecutable” specifies a file that is not executable
HYPhotoLibraryKit_Example.app does not contain a valid Info.plist, so it cannot be installed on “Bill”的 iPhone (2)
(“CFBundleExecutable” specifies a file that is not executable)
ld: warning: directory not found for option '-F/Users/jiangweidong/Library/Developer/Xcode/DerivedData/HYPhotoLibraryKit-ffxhyajjfaekfggrljgbkkndupve/Build/Products/Debug-iphoneos/EasyDarkMode'
ld: warning: directory not found for option '-F/Users/jiangweidong/Library/Developer/Xcode/DerivedData/HYPhotoLibraryKit-ffxhyajjfaekfggrljgbkkndupve/Build/Products/Debug-iphoneos/HYBasicToolKit'
ld: warning: directory not found for option '-F/Users/jiangweidong/Library/Developer/Xcode/DerivedData/HYPhotoLibraryKit-ffxhyajjfaekfggrljgbkkndupve/Build/Products/Debug-iphoneos/HYPhotoLibraryKit'
ld: warning: directory not found for option '-F/Users/jiangweidong/Library/Developer/Xcode/DerivedData/HYPhotoLibraryKit-ffxhyajjfaekfggrljgbkkndupve/Build/Products/Debug-iphoneos/HYVideoPlayerKit'
ld: warning: directory not found for option '-F/Users/jiangweidong/Library/Developer/Xcode/DerivedData/HYPhotoLibraryKit-ffxhyajjfaekfggrljgbkkndupve/Build/Products/Debug-iphoneos/SDWebImage'
ld: warning: directory not found for option '-F/Users/jiangweidong/Library/Developer/Xcode/DerivedData/HYPhotoLibraryKit-ffxhyajjfaekfggrljgbkkndupve/Build/Products/Debug-iphoneos/XHNetworkCache'
ld: framework not found EasyDarkMode
clang: error: linker command failed with exit code 1 (use -v to see invocation)
https://blog.csdn.net/longshihua/article/details/78054446
很奇怪干花,為什么已經(jīng)從項目中刪除了文件和文件夾還是報這個警告呢妄帘?
去掉警告的辦法如下:
1.選擇工程, 編譯的 (targets)
2.選擇 Build Settings 菜單
3.查找 Library Search Paths 和 Framework Search Paths, 刪掉編譯報warning的路徑即OK
ld: framework not found ***
進入Build Settings
搜索OTHER LINKER FLAGS
-framework這個標志是給你帶.framework的文件使用的池凄,所以你需要找出來那些不需要-framework的框架抡驼,把它下面的-framework刪除掉。
dyld: Library not loaded: @rpath/EasyDarkMode.framework/EasyDarkMode
Referenced from: /private/var/containers/Bundle/Application/92D0BF75-B0DF-48AD-9439-A70DD4D8DD59/HYPhotoLibraryKit_Example.app/HYPhotoLibraryKit_Example
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
解決方案:在Podfile中肿仑,注釋use_frameworks!后致盟,重新執(zhí)行pod install。
podspec 驗證的時候 報錯
- ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
- NOTE | xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)
如果私有庫添加了靜態(tài)庫或者dependency用了靜態(tài)庫
那么執(zhí)行pod lib lint還有pod spec lint時候需要加上—user-libraries選項
否則會出現(xiàn)'The 'Pods' target has transitive dependencies錯誤尤慰。
http://www.reibang.com/p/bdb1db6c9db4/
pod spec 驗證發(fā)布時的參數(shù)
Usage:
$ pod lib lint [PODSPEC_PATHS ...]
Validates the Pod using the files in the working directory.
Options:
--quick Lint skips checks that would require to
download and build the spec
--allow-warnings Lint validates even if warnings are
present
--subspec=NAME Lint validates only the given subspec
--no-subspecs Lint skips validation of subspecs
--no-clean Lint leaves the build directory intact
for inspection
--fail-fast Lint stops on the first failing platform
or subspec
--use-libraries Lint uses static libraries to install the
spec
--use-modular-headers Lint uses modular headers during
installation
--use-static-frameworks Lint uses static frameworks during
installation
--sources=https://cdn.cocoapods.org/ The sources from which to pull dependent
pods (defaults to
https://cdn.cocoapods.org/). Multiple
sources must be comma-delimited
--platforms=ios,macos Lint against specific platforms (defaults
to all platforms supported by the
podspec). Multiple platforms must be
comma-delimited
--private Lint skips checks that apply only to
public specs
--swift-version=VERSION The `SWIFT_VERSION` that should be used
to lint the spec. This takes precedence
over the Swift versions specified by the
spec or a `.swift-version` file
--include-podspecs=**/*.podspec Additional ancillary podspecs which are
used for linting via :path
--external-podspecs=**/*.podspec Additional ancillary podspecs which are
used for linting via :podspec. If there
are --include-podspecs, then these are
removed from them
--skip-import-validation Lint skips validating that the pod can be
imported
--skip-tests Lint skips building and running tests
during validation
--test-specs=test-spec1,test-spec2,etc List of test specs to run
--analyze Validate with the Xcode Static Analysis
tool
--configuration=CONFIGURATION Build using the given configuration
(defaults to Release)
--allow-root Allows CocoaPods to run as root
--silent Show nothing
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
–use-libraries使用靜態(tài)庫馏锡,如果在工程中使用到了靜態(tài)庫,但不在編譯的時候加上這句話伟端,就不能編譯通過眷篇。如果私有庫中存在.a文件,那么必須加上這個后綴荔泳。
–allow-warnings允許警告,警告可能會導致編譯不能通過虐杯,一般需要加上它玛歌。
–sources=BIFaceSDK,BIEncrypt說明庫的依賴關系,這里說明了庫依賴于BIFaceSDK,BIEncrypt這兩個pods擎椰。
–skip-import-validation和–skip-tests這兩個命令可以跳過部分驗證環(huán)節(jié)支子,如果發(fā)現(xiàn)工程怎么都lint不過,那么可以嘗試一下這個达舒。
需要注意的地方:
–skip-import-validation和–skip-tests
這樣操作之后值朋,確實可以實現(xiàn)pod的更新,但是最終工程中的pod可能會發(fā)生丟失部分文件巩搏,找不到索引等意外昨登。因此,還是要謹慎操作哈贯底!
經(jīng)典錯誤 - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.
這次報錯事因為再依賴三方庫中有靜態(tài)庫丰辣,而三方的阿里云只支持真機架構(gòu)
所以在 .podspec中添加指定的架構(gòu)
s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
這個問題真的是很令人頭疼,折騰了兩天,也看了網(wǎng)上的一些解決辦法笙什,包括StackOverFlow飘哨,有成功的也有不成功的,成功的我也覺得不是最佳琐凭。我就去翻CocoaPods GitHub Issues芽隆,終于讓我翻到了。
- Undefined symbols for architecture i386 even though it's omitted from VALID_ARCHS #8129
- Fix linting when armv7 is included but i386 isn't #8159
8129這個問題在 CocoaPods 1.6.0.beta.2 版本得到了修復
-
先升級到CocoaPods Beta版
$ sudo gem install -n /usr/local/bin cocoapods --pre
-
編輯podspec统屈,加入 pod_target_xcconfig
s.pod_target_xcconfig = { 'VALID_ARCHS' => 'arm64 armv7 x86_64' }
什么是 pod_target_xcconfig ?
Any flag to add to the final private pod target xcconfig file.
要添加到最終私有pod目標xcconfig文件的任何標志胚吁。
CocoaPods 常規(guī)error https://github.com/CocoaPods/CocoaPods/issues/
獲取圖片資源路徑
參考
http://www.reibang.com/p/e772b0713f9a
Showing Recent Errors Only
Undefined symbol: _Decoder_Interface_init
私有庫中包含有第三方的靜態(tài)庫。
解決辦法需要在 podspec中添加:靜態(tài)庫的絕對路徑
s.vendored_libraries = 'HYKeyboardKit/Classes/RecordAudio/BlazeiceAudio/voiceConvert/lib/*.{a}'