iOS-创建私有库遇到的问题&创建code Repository库遇到的问题

1. 创建私有库,将 NetworkStatus.podspec 配置文件push到私有库 遇到问题
$ pod repo push Specs NetworkStatus.podspec 

报错了 [!] Couldn't find NetworkStatus.podspec

解决方法: 在创建自己的 code Repository的时候最后一步操作不需要执行 pod trunk push NetworkStatus.podspec 操作, 在上一步的位置操作(指的是在创建code repository的文件目录下面操作)

2. - ERROR | [iOS] unknown: Encountered an unknown error (XXXXXX) during validation.
[!] The NetworkStatus.podspec specification does not validate.

解决:版本标签需要推送到远程 git push --tags

3.

-> AWNetworkStatus (0.0.1)
- WARN | source: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.
- WARN | url: There was a problem validating the URL [email protected]:maling/AWNetworkStatus.

解决:不能使用git开头的地址,需要使用http 或者 https 开头的地址

4. - ERROR | [iOS] file patterns: The source_files pattern did not match any file.

这个问题解决过程甚是头疼, 网上查找的都是说的文件路径不对, 都没给出解决方案,解决过程也是老费劲了,解决方案:
/Users/Library/Caches/CocoaPods/Pods/External/xxxxxx/6caecc3e367ba2e8852334d3c51e1214-f25d4

xxxxxx就是你要发布的pod库文件
在这个路径下你会发现没有xxxxxx代码文件,你可以直接拷贝一份放到/Users/Library/Caches/CocoaPods/Pods/External/xxxxxx/6caecc3e367ba2e8852334d3c51e1214-f25d4下面,这个里面会有 xxxxxx文件,LICENSE, README.md 三个文件,这个时候才是应该有的内容。

5. - ERROR | [iOS] xcodebuild: Returned an unsuccessful exit code. You can use --verbose for more information.

解决方案: 我导入的系统库有冲突造成的,删除导入的系统库就好了

(遇到这个问题上网查找解决方案的时候发现,遇到的问题一样,解决方案各不相同,猜测这个问题是各种不明确的问题都会报这个错误,有可能这个解决方案不适合你,就需要你自己多看别人的解决方案是不是和你的一样,自己多尝试,反正我是通过删除引用的系统库这个问题就消失了)

6. - ERROR | [iOS] file patterns: The resources pattern did not match any file.

遇到这个问题说明资源文件路径不对,经过检查发现自己马虎路径写错了将Classes/MGKit.bundle路径写成了Class/MGKit.bundle,造成的错误。
解决方案: 仔细检查podsepc路径是不是和你实际文件的路径一致。

7. ERROR | [iOS] unknown: Encountered an unknown error (Unable to find a specification for AWReachability depended upon by AWAdsLib) during validation.

解决方案:AWReachability 为私有库,不能创建库的时候依赖私有库,添加参数

--sources='https://github.com/CocoaPods/Specs.git, https://github.com/xxxx/xxSpecs.git
8. - ERROR | [AWAdsLib/Banner, AWAdsLib/Interstitial, AWAdsLib/Native, and more...] xcodebuild: Returned an unsuccessful exit code.
  • NOTE | [iOS] [AWAdsLib/Native] xcodebuild: /Users/maling/Desktop/AWAdsLib/AWAdsLib/Native/WMD/AWAdWMDNativeAd.m:12:9: fatal error: 'WMAdSDK/WMAdSDKManager.h' file not found

解决方案: 文件引入问题,需要给AWAdWMDNativeAd引入需要的文件路径

9. - NOTE | [AWAdsLib/Interstitial,AWAdsLib/Native] xcodebuild: clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方案: 静态库引入问题,在需要使用静态库的地方引入静态库

10.上传私有库完成后 添加类文件,上传成功pod下载下来的数据没有

pod lib lint --verbose --use-libraries --allow-warnings --no-clean
git add .
git commit -m "commit2"
git push origin master
pod repo push AWSpecs AWAdsLib.podspec --verbose --use-libraries --allow-warnings
解决方案: 重新打了一个tag标签 验证通过,提交成功, 下载成功

11. - ERROR | [AWAdsLib/Native] xcodebuild: Returned an unsuccessful exit code.
  • NOTE | [AWAdsLib/Native] xcodebuild: error: invalid task ('StripNIB /Users/maling/Library/Developer/Xcode/DerivedData/App-fyjwbdljqyusxfdkoqquzzllyqoi/Build/Products/Release-iphonesimulator/AWAdsLib/AWGADUnifiedNativeAdView.nib') with mutable output but no other virtual output node (in target 'AWAdsLib')

解决方案:因为xib和图片等属于资源文件,不能放在源文件中(Classes),需要放在Assets中,如果都放在classes中,在验证的时候会遇到这个问题:)

12.[!] Found multiple specifications for AWReachability (0.0.1):

[!] Found multiple specifications for AWReachability (0.0.1):
/Users/maling/.cocoapods/repos/master/Specs/7/0/b/AWReachability/0.0.1/AWReachability.podspec.json
/Users/maling/.cocoapods/repos/AWSpecs/AWReachability/0.0.1/AWReachability.podspec

  • 原因:将私有仓库拉到本地时可能会存在两个。

  • 解释:因为 git 存在两个地址,分别是 git@ 和 http/https,所以有时候可能会在本地 repos 下出现两个基于同一个 git 的仓库,仓库名字不同。因为一开始 lint 的时候是指定了仓库名的,所以能通过,但 pod repo push 的时候虽然指定了 push 的仓库名,但因为没有指定校验的仓库名,一旦你的 pod 依赖了私有仓库中的某个 pod,校验时会出现类似 [!] Found multiple specifications xxxxLibrary 的错误。此时需要删除掉一个私有仓库,然后重新 push 才行。

  • 备注:这里需要明白 pod spec lint 的时候,可以配置 --sources。而 pod repo push 的时候,是直接使用的本地仓库名。有可能 --sources 指定的是 http/https ,而本地 repo 仓库是使用的 git@ 拉取的。

pod spec lint --verbose --use-libraries --allow-warnings --sources='私有仓库repo地址,https://github.com/CocoaPods/Specs'

pod repo push MCRepo MCAppKit.podspec --verbose --use-libraries --allow-warnings

该解决方案来自这里地址

你可能感兴趣的:(iOS-创建私有库遇到的问题&创建code Repository库遇到的问题)