2

我在 swift 中创建了一个依赖于 Facebook SDK 的项目(它是用目标 C 编写的,默认情况下作为源下载)。
当我使用我的 mac 进行项目时,一切都很好,
我创建了以下 pod 文件:

# Uncomment this line to define a global platform for your project
platform :ios, '8.0'
# Uncomment this line if you're using Swift
   use_frameworks!
   target 'MyProj' do
       pod 'FBSDKLoginKit', '~> 4.9'

end

运行 ** pod install** 就可以了(Facebook 下载为框架,因此我的代码中没有 obj-c 和 swift 的任何组合)。

现在我完成了我的项目并想将它上传到 Cocoapods,所以我创建了以下 podspec:

Pod::Spec.new do |s|
    s.name         = "MyProj"
    s.version      = '0.0.1'
    s.platform     = :ios, '8.0'
    s.requires_arc = true
    s.summary      = "summery"
    s.homepage     = "https://www.google.com"
    s.license      = 'Apache License, Version 2.0'
    s.author       = { "Asaf" => "asaf@a.b" }
    s.source       = { :git => 'https://github.com/asaf.git', :tag => '0.0.1'}
    s.dependency 'FBSDKLoginKit', '~> 4.9'
    s.source_files = 'Source/myfile.swift'

end

为了验证我的 pod 规格是否正确,我使用 lint 它

pod spec lint mypodspec.podspec --use-libraries --verbose

但我得到

  • 错误 | [iOS] 未知:在验证期间遇到未知错误(用 Swift 编写的 Pod 只能集成为框架;添加use_frameworks!到您的 Podfile 或目标以选择使用它。正在使用的 Swift Pod 是:myProj)。

任何人都知道我应该怎么做才能解决这个问题?谢谢

4

1 回答 1

2

我自己找到了答案。
将 Cocoapods 更新到 1.0.0 版(目前为 beta 版)并从 lint 命令中删除“--use-libraries”,解决了这个问题。

于 2016-02-16T15:24:51.890 回答