简体   繁体   English

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

[英]Xcode/Cocoapods Project messed up after adding a TVOS Target and changing Podfile structure

I'm working on a larger project(Swift) with some Pods and everything was fine so far... Bu now I wanted to add a tvos target and now my project is messed up :(我正在使用一些 Pod 处理一个更大的项目(Swift),到目前为止一切都很好......但现在我想添加一个 tvos 目标,现在我的项目一团糟:(

And there is an easy way to reproduce:并且有一种简单的方法可以重现:

1.) create a new SingleView Application and name it "pod-test" in Xcode 1.) 创建一个新的 SingleView 应用程序并在 Xcode 中将其命名为“pod-test”

2.) open it an run it 2.) 打开它并运行它

3.) run pod init to create the Podfile 3.) 运行 pod init 创建 Podfile

4.) Edit the Podfile with this: use_frameworks! 4.) 使用以下命令编辑 Podfile:use_frameworks! platform :ios, '8.0'平台: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.) run pod install 5.) 运行 pod install

6.) open workspace project file an run the application 6.) 打开工作区项目文件并运行应用程序

7.) now add the twos target and name it "pod-test-tvos" 7.) 现在添加两个目标并将其命名为“pod-test-tvos”

8.) run iOS and tvos app. 8.) 运行 iOS 和 tvos 应用程序。 Everything still fine一切都还好

9.) edit the Podfile with this: 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.) Edit configuration for pod-test and pod-test-tvos to none 10.) 将 pod-test 和 pod-test-tvos 的配置编辑为 none

10.) close XCode 10.) 关闭 XCode

11.) run pod install again 11.) 再次运行 pod install

12.) Open Xcode again 12.) 再次打开Xcode

13.) run iOS and TVOS apps again... Still everything is fine 13.) 再次运行 iOS 和 TVOS 应用程序...仍然一切正常

14.) edit "AppDelegate" for both targets and add just this import: 14.) 为两个目标编辑“AppDelegate”并仅添加此导入:

import Fabric

15.) run iOS and TVOS apps again... and boom... iOS runs fine TVOS says Fabric is not found :( 15.) 再次运行 iOS 和 TVOS 应用程序......然后繁荣...... iOS 运行良好 TVOS 说没有找到 Fabric :(

This all just happens, because I "changed" the Podfile after adding the TVOS target...这一切都发生了,因为我在添加 TVOS 目标后“更改”了 Podfile ......

With just this steps everything is fine:只需这一步,一切都很好:

1.) create a new SingleView Application and name it "pod-test" in Xcode 1.) 创建一个新的 SingleView 应用程序并在 Xcode 中将其命名为“pod-test”

2.) now add the twos target and name it "pod-test-tkos" 2.) 现在添加两个目标并将其命名为“pod-test-tkos”

3.) run pod init to create the Podfile 3.) 运行 pod init 创建 Podfile

4.) edit the Podfile with this: 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.) run pod install 5.) 运行 pod install

6.) open workspace project file an run the application 6.) 打开工作区项目文件并运行应用程序

7.) edit "AppDelegate" for both targets and add just this import: 7.) 为两个目标编辑“AppDelegate”并仅添加此导入:

import Fabric

8.) run iOS and TVOS apps again... Still everything is fine 8.) 再次运行 iOS 和 TVOS 应用程序...仍然一切正常

So, there seems to be a problem with changing the Podfile in an "older" Project...因此,在“旧”项目中更改 Podfile 似乎存在问题......

I hope somebody can help me out with this :)我希望有人能帮我解决这个问题:)

This can be resolved by using the deintegrate command in Cocoapods 1.0.这可以通过使用 Cocoapods 1.0 中的deintegrate命令来解决。

  1. Close Xcode关闭 Xcode
  2. Open Terminal and navigate to the directory that contains your Podfile.打开终端并导航到包含 Podfile 的目录。
  3. pod deintegrate
  4. pod install
  5. Open your workspace in Xcode and build.在 Xcode 中打开您的工作区并构建。

I had exactly the same problem.我遇到了完全相同的问题。 I don't know why.我不知道为什么。 Inspired by your experimentation, I downloaded the Cocoapods app , and used it to remove Cocoapods from my project.受到您实验的启发,我下载了Cocoapods 应用程序,并使用它从我的项目中删除了 Cocoapods。 I then reinstalled cocoapods and now it works just fine.然后我重新安装了 cocoapods,现在它工作得很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM