Pod spec私有库集成遇到的错误(二)

  • 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
本地脚本编译出错

  1. 选中项目 -> TARGETS->Build Phases-> “Bundle React Native code and images”

2.勾选 “Run script only when installing”


image.png


“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)

image.png


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)

image.png

https://blog.csdn.net/longshihua/article/details/78054446

很奇怪,为什么已经从项目中删除了文件和文件夹还是报这个警告呢?

去掉警告的办法如下:

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!后,重新执行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)
image.png
image.png

如果私有库添加了静态库或者dependency用了静态库
那么执行pod lib lint还有pod spec lint时候需要加上—user-libraries选项
否则会出现'The 'Pods' target has transitive dependencies错误。

https://www.jianshu.com/p/bdb1db6c9db4/

pod spec 验证发布时的参数

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使用静态库,如果在工程中使用到了静态库,但不在编译的时候加上这句话,就不能编译通过。如果私有库中存在.a文件,那么必须加上这个后缀。
–allow-warnings允许警告,警告可能会导致编译不能通过,一般需要加上它。
–sources=BIFaceSDK,BIEncrypt说明库的依赖关系,这里说明了库依赖于BIFaceSDK,BIEncrypt这两个pods。
–skip-import-validation和–skip-tests这两个命令可以跳过部分验证环节,如果发现工程怎么都lint不过,那么可以尝试一下这个。

需要注意的地方:
–skip-import-validation和–skip-tests
这样操作之后,确实可以实现pod的更新,但是最终工程中的pod可能会发生丢失部分文件,找不到索引等意外。因此,还是要谨慎操作哈!



经典错误 - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code.

9C72DBF8-026C-49A0-9311-E435073DE805.png

这次报错事因为再依赖三方库中有静态库,而三方的阿里云只支持真机架构
所以在 .podspec中添加指定的架构

s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
  s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }

这个问题真的是很令人头疼,折腾了两天,也看了网上的一些解决办法,包括StackOverFlow,有成功的也有不成功的,成功的我也觉得不是最佳。我就去翻CocoaPods GitHub Issues,终于让我翻到了。

8129这个问题在 CocoaPods 1.6.0.beta.2 版本得到了修复

  1. 先升级到CocoaPods Beta版

    $ sudo gem install -n /usr/local/bin cocoapods --pre
    
    
  2. 编辑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 常规error https://github.com/CocoaPods/CocoaPods/issues/



获取图片资源路径
参考
https://www.jianshu.com/p/e772b0713f9a



Showing Recent Errors Only
Undefined symbol: _Decoder_Interface_init

私有库中包含有第三方的静态库。
解决办法需要在 podspec中添加:静态库的绝对路径

s.vendored_libraries = 'HYKeyboardKit/Classes/RecordAudio/BlazeiceAudio/voiceConvert/lib/*.{a}'
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 199,902评论 5 468
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,037评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 146,978评论 0 332
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 53,867评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 62,763评论 5 360
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,104评论 1 277
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,565评论 3 390
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,236评论 0 254
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,379评论 1 294
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,313评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,363评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,034评论 3 315
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,637评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,719评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,952评论 1 255
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,371评论 2 346
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 41,948评论 2 341

推荐阅读更多精彩内容