我已经在Swift中创建了一个库,并试图将该库上传到cocoapods(我不确定这是否可能,但我认为必须如此)。我从来没有上传过图书馆到可可豆,所以我不知道如何做到这一点。我已经在GitHub有图书馆了。
我就是这么想的:
打开终端并键入以下命令:
pod spec create JHProgressHUD
这创建了一个
JHProgressHUD.podspec
文件。我将文件的全部默认内容替换为以下内容:Pod::Spec.new do |spec|
spec.name = 'JHProgressHUD'
spec.version = '1.0.0'
spec.license = { :type => 'MIT' }
spec.homepage = 'https://github.com/harikrishnant1991/JHProgressHUD'
spec.authors = { 'Harikrishnan T' => 'harikrishnant1991@yahoo.com' }
spec.summary = 'IOS HUD Swift Library'
spec.source = { :git => 'https://github.com/harikrishnant1991/JHProgressHUD.git', :tag => '1.0.0' }
spec.ios.deployment_target = '7.0'
spec.platform = :ios, '7.0'
spec.source_files = 'JHProgressHUD.swift'
end
然后我尝试了以下命令:
pod spec lint JHProgressHUD.podspec
但我得到了以下错误:
-> JHProgressHUD (1.0.0)
- ERROR | [xcodebuild] error: /Applications/Xcode 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Analyzed 1 podspec.
[!] The spec did not pass validation.
是什么导致了这个错误?因为这是我第一次尝试在cocoapods中添加库,所以我不确定这是否发生,因为这是一个swift库。我在一个项目中试过这个库,它编译和运行都很好。有谁能给我介绍一下如何在可可豆上添加一个库吗?我只找到了一些教程,但没有一个很有帮助。有没有可能在椰子荚中添加一个swift库?
最佳答案
我不知道你是否也有同样的问题
Error when compiling a static library using Swift "unknown option character `X' in: -Xlinker"
https://github.com/CocoaPods/CocoaPods/issues/2226
他们还在努力
有一种方法可以上传你的swift库
https://github.com/CocoaPods/CocoaPods/issues/2272
http://www.swifttoolbox.io/
关于cocoa - 将库上传到 cocoa pod ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27269314/