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,终于让我翻到了。

  • 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 版本得到了修复

  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}'

你可能感兴趣的:(Pod spec私有库集成遇到的错误(二))