Glenn Howes
Glenn Howes

Reputation: 5597

Cocoapod pod only for a specified platform

I have an Xcode project with multiple targets. One of those targets targets the tvOS platform. My other targets make use of the 'youtube-iso-player-helper' framework, which does not support tvOS. I want to have a Cocoapod Podfile that includes the player framework only on iOS.

Here is my current Podfile:

source 'https://github.com/CocoaPods/Specs.git' 
platform :ios, '8.0'
platform :tvos, '9.0'

use_frameworks!

pod 'SVGgh'

pod "youtube-ios-player-helper", "~> 0.1"

xcodeproj 'MyProject.xcodeproj'

When I try to update my pods, I get the following error:

[!] The platform of the target Pods (tvOS 9.0) is not compatible with youtube-ios-player-helper (0.1.4), which does not support tvos.

Obviously, this is using the current version of Cocoapods.

So, I need to know the syntax required for my Podfile.

Upvotes: 5

Views: 7541

Answers (4)

CodyMace
CodyMace

Reputation: 655

It's actually not just you podfile, but the creator of the pod needs to enable apple TV. You can read about it here http://blog.cocoapods.org/CocoaPods-0.39/

Upvotes: 0

TurboManolo
TurboManolo

Reputation: 281

Just came across a similar problem and I've fixed it by using this pattern:

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

def shared_pods
    pod 'SVGgh'
end

target 'myiOSTargetName' do
    platform :ios, '8.0'
    use_frameworks! 
    shared_pods
    pod "youtube-ios-player-helper", "~> 0.1"
end

target 'mytvOSTargetName' do
    platform :tvos, '9.0'  
    use_frameworks! 
    shared_pods
end

I haven't tested it but I hope it helps! Cheers

Upvotes: 0

Claes
Claes

Reputation: 236

This seems to work for me:

target 'iOSAppTarget' do
  platform :ios, '8.0'
  pod 'PodForiOS'
end

target 'TVAppTarget' do
  platform :tvos, '9.0'
  pod 'PodForTV'
end

Upvotes: 3

Dima Cheverda
Dima Cheverda

Reputation: 402

I have similar problem, but with framework. Try to use target and link_with to install pod for specific target:

target :tvos, :exclusive => true do
    use_frameworks!
    link_with 'AppName'
    pod "youtube-ios-player-helper", "~> 0.1"
end

Upvotes: -1

Related Questions