Xcode / Cocoapods项目在添加TVOS目标和更改Podfile结构后搞砸了

时间:2016-04-14 14:05:35

标签: ios swift xcode7 cocoapods crashlytics

我正在研究更大的项目(Swift)和一些Pods,到目前为止一切都很好...... 现在我想添加一个tvos目标,现在我的项目搞砸了:(

有一种简单的方法可以重现:

1。)创建一个新的SingleView应用程序,并在Xcode中将其命名为“pod-test”

2。)打开它吧

3.)运行pod init以创建Podfile

4.)使用以下命令编辑Podfile:     use_frameworks!     平台:ios,'8.0'

pod 'Alamofire'
pod 'ObjectMapper'
pod 'AlamofireObjectMapper'

pod 'Fabric'
pod 'Crashlytics'

pod 'Nuke'
pod 'MGSwipeTableCell'
pod 'GradientCircularProgress', :git => 'https://github.com/keygx/GradientCircularProgress'

pod 'Reveal-iOS-SDK', :configurations => ['Debug']

5.运行pod install

6。)打开工作区项目文件并运行应用程序

7。)现在添加两个目标,并将其命名为“pod-test-tvos”

8。)运行iOS和tvos应用程序。一切都还不错

9。)使用以下命令编辑Podfile:

source 'https://github.com/CocoaPods/Specs.git'


target 'pod-test' do
    use_frameworks!
    platform :ios, '8.0'

    pod 'Alamofire'
    pod 'ObjectMapper'
    pod 'AlamofireObjectMapper'

    pod 'Fabric'
    pod 'Crashlytics'

    pod 'Nuke'
    pod 'MGSwipeTableCell'
    pod 'GradientCircularProgress', :git => 'https://github.com/keygx/GradientCircularProgress'

    pod 'Reveal-iOS-SDK', :configurations => ['Debug']
end

target 'pod-test-tvos' do
    use_frameworks!
    platform :tvos, '9.0'

    pod 'Fabric'
    pod 'Crashlytics'

end

10。)将pod-test和pod-test-tvos的配置编辑为无

10。)关闭XCode

11。)再次运行pod install

12。)再次打开Xcode

13。)再次运行iOS和TVOS应用程序......一切都很好

14。)为两个目标编辑“AppDelegate”并添加此导入:

import Fabric
15。)再次运行iOS和TVOS应用程序......并且繁荣...... iOS运行良好TVOS说没有找到Fabric:(

这一切都发生了,因为我在添加TVOS目标后“更改”了Podfile ...

只需这一步就可以了:

1。)创建一个新的SingleView应用程序,并在Xcode中将其命名为“pod-test”

2.)现在添加两个目标,并将其命名为“pod-test-tkos”

3.)运行pod init以创建Podfile

4。)使用以下命令编辑Podfile:

source 'https://github.com/CocoaPods/Specs.git'


target 'pod-test' do
    use_frameworks!
    platform :ios, '8.0'

    pod 'Alamofire'
    pod 'ObjectMapper'
    pod 'AlamofireObjectMapper'

    pod 'Fabric'
    pod 'Crashlytics'

    pod 'Nuke'
    pod 'MGSwipeTableCell'
    pod 'GradientCircularProgress', :git => 'https://github.com/keygx/GradientCircularProgress'

    pod 'Reveal-iOS-SDK', :configurations => ['Debug']
end

target 'pod-test-tvos' do
    use_frameworks!
    platform :tvos, '9.0'

    pod 'Fabric'
    pod 'Crashlytics'

end

5.运行pod install

6。)打开工作区项目文件并运行应用程序

7.。)为两个目标编辑“AppDelegate”并添加此导入:

import Fabric

8。)再次运行iOS和TVOS应用程序......仍然一切正常

因此,在“旧”项目中更改Podfile似乎存在问题......

我希望有人可以帮助我解决这个问题:)

2 个答案:

答案 0 :(得分:5)

可以使用Cocoapods 1.0中的deintegrate命令解决此问题。

  1. 关闭Xcode
  2. 打开终端并导航到包含Podfile的目录。
  3. pod deintegrate
  4. pod install
  5. 在Xcode中打开工作区并构建。

答案 1 :(得分:0)

我有完全相同的问题。我不知道为什么。在您的实验的启发下,我下载了Cocoapods app,并用它从我的项目中删除了Cocoapods。然后我重新安装了cocoapods,现在它工作得很好。