【问题标题】:Xcode/Cocoapods Project messed up after adding a TVOS Target and changing Podfile structureXcode/Cocoapods 项目在添加 TVOS 目标和更改 Podfile 结构后搞砸了
【发布时间】:2016-08-06 03:42:22
【问题描述】:

我正在使用一些 Pod 开发一个更大的项目(Swift),到目前为止一切都很好...... 但是现在我想添加一个 tvos 目标,现在我的项目搞砸了:(

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

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

2.) 打开它并运行它

3.) 运行 pod init 来创建 Podfile

4.) 使用以下命令编辑 Podfile: 使用_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 安装

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 安装

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

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

import Fabric

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

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

我希望有人能帮我解决这个问题:)

【问题讨论】:

    标签: ios swift xcode cocoapods crashlytics


    【解决方案1】:

    这可以通过使用 Cocoapods 1.0 中的deintegrate 命令解决。

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

    【讨论】:

    • 你是个⭐️。经过几个小时的尝试,这救了我。
    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 2012-11-13
      • 2018-06-05
      • 1970-01-01
      • 2010-11-01
      • 2020-10-13
      • 1970-01-01
      • 2016-04-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多