Urkman
Urkman

Reputation: 1318

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 :(

And there is an easy way to reproduce:

1.) create a new SingleView Application and name it "pod-test" in Xcode

2.) open it an run it

3.) run pod init to create the Podfile

4.) Edit the Podfile with this: 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']

5.) run pod install

6.) open workspace project file an run the application

7.) now add the twos target and name it "pod-test-tvos"

8.) run iOS and tvos app. Everything still fine

9.) edit the Podfile with this:

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.) close XCode

11.) run pod install again

12.) Open Xcode again

13.) run iOS and TVOS apps again... Still everything is fine

14.) edit "AppDelegate" for both targets and add just this import:

import Fabric

15.) run iOS and TVOS apps again... and boom... iOS runs fine TVOS says Fabric is not found :(

This all just happens, because I "changed" the Podfile after adding the TVOS target...

With just this steps everything is fine:

1.) create a new SingleView Application and name it "pod-test" in Xcode

2.) now add the twos target and name it "pod-test-tkos"

3.) run pod init to create the Podfile

4.) edit the Podfile with this:

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

6.) open workspace project file an run the application

7.) edit "AppDelegate" for both targets and add just this import:

import Fabric

8.) run iOS and TVOS apps again... Still everything is fine

So, there seems to be a problem with changing the Podfile in an "older" Project...

I hope somebody can help me out with this :)

Upvotes: 1

Views: 1235

Answers (2)

Isaac Overacker
Isaac Overacker

Reputation: 1535

This can be resolved by using the deintegrate command in Cocoapods 1.0.

  1. Close Xcode
  2. Open Terminal and navigate to the directory that contains your Podfile.
  3. pod deintegrate
  4. pod install
  5. Open your workspace in Xcode and build.

Upvotes: 5

Hilton Campbell
Hilton Campbell

Reputation: 6095

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. I then reinstalled cocoapods and now it works just fine.

Upvotes: 0

Related Questions