如何将cocoapod导入Xcode 7.3?

时间:2016-06-02 17:13:00

标签: xcode uitableview cocoapods swift-playground

我查看了许多指南,他们似乎都指向使用' link_with' podfile的命令,如本教程:

https://littlebitesofcocoa.com/138-using-cocoapods-in-xcode-playgrounds

然而,当我尝试这个时,cocoapod似乎不喜欢我的podfile的语法,并会告诉我' link_with'现在不受支持,它似乎将playground文件的名称解释为podfile。

target 'Jawn’ do
  link_with 'UrlMetaData'             <----- (UrlMetaData.playground)
  use_frameworks!
  platform :ios, '8.4'
  pod 'Kanna', '~> 1.0.0'
  pod 'SlackTextViewController'
  pod 'M13ProgressSuite'
  pod 'Alamofire', '~> 3.4'
  pod 'YouTubePlayer'
  workspace 'Jawn'
end

当我进行pod安装时,我将获得以下输出:

My-iMac:MyProject USERNAME$ pod install

[!] Invalid `Podfile` file: [!] The specification of `link_with` in the Podfile is now unsupported, please use target blocks instead..

 #  from /Users/USERNAME/Xcode Projects/MyProject/Podfile:2
 #  -------------------------------------------
 #  target 'Jawn' do
 >    link_with 'UrlMetaData'
 #    use_frameworks!
 #  -------------------------------------------

3 个答案:

答案 0 :(得分:1)

如果你有多个目标,

像这样写你的podfile。

SELECT
    g.PartNum,
    g.Supplier,
    SUM(g.InitialQuantityToInventory + COALESCE(t.adjRet, 0))
FROM Goodsin g
LEFT JOIN 
    (
        SELECT GINum, SUM(AmountInventoryAdjusted + AmountReturned) AS adjRet
        FROM Transfers
        GROUP BY GINum
    ) T
    ON t.GINum = g.GiNum
GROUP BY g.PartNum,    g.Supplier

如果您有多个目标,将所有依赖项添加到一个位置会很有帮助。

答案 1 :(得分:0)

将podfile放在项目所在的文件夹中,并确保目标正确。

我的pod文件如下所示:

target 'ProjectName' do

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, ‘8.0’
use_frameworks!

pod 'Alamofire', '~> 3.4'

end

快乐编码

答案 2 :(得分:0)

使用Xcode 7.3安装pod

# Uncomment this line to define a global platform for your project
 platform :ios, '9.0'

target 'demoAlamofire' do
  # Comment this line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for demoAlamofire

  pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire'
  pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

  target 'demoAlamofireTests' do
    inherit! :search_paths
    # Pods for testing
  end

  target 'demoAlamofireUITests' do
    inherit! :search_paths
    # Pods for testing
  end

end