Komal Goyani
Komal Goyani

Reputation: 847

How to use same pods for iOS and tvOS?

I want to use same pod for iOS and tvOS. For that i have write code in pod file like this,

def shared_pods
    pod 'Moya', '~> 9.0' #Alamofire wrapper
    pod 'AlamofireNetworkActivityLogger', '~> 2.0'
    pod 'AlamofireObjectMapper'
    pod 'ReachabilitySwift', '~> 4.0'
    pod 'SDWebImage', '~> 4.4.5'

end

target 'iosApp' do
  platform :ios, '9.0'
  use_frameworks!
  inhibit_all_warnings!
  shared_pods

end

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

But i get the error The platform of the target TVApp (tvOS 9.0) is not compatible with Stripe, which does not support tvOS.

Other pods like, pod 'DynamicCodable' pod 'Stripe', '~> 15.0.1' pod 'GooglePlacesSearchController' pod 'Google-Mobile-Ads-SDK' pod 'NTMonthYearPicker' pod 'NYTPhotoViewer', '~> 1.1.0' pod 'MGSwipeTableCell' pod 'SendBirdSDK', '~> 3.0' pod 'FLAnimatedImage' pod 'RSKImageCropper' #tappable label pod 'ActiveLabel' #calendar pod 'FSCalendar' #Location pod 'GooglePlaces' pod 'CreditCardValidator' pod 'FittedSheets' pod 'Branch' pod 'CarbonKit' pod 'AWSS3' also not compatible with tvOS, but i want to use those in tvOS.

How can i use same framework for both OS?

Upvotes: 2

Views: 1879

Answers (3)

alxlives
alxlives

Reputation: 5212

The Moya pod is compatible with tvOS, as you can see in its .podspec file:

  s.tvos.deployment_target = '9.0'

I tried running a project with your .podspec configuration, and had some problems with an outdated Moya sub dependency "Result", "~> 3.0". However, on the last release, this dependency has been updated to "Result", "~> 4.1", and I was able to run Moya on iOS 9.0 tvOS successfully.

Try using the most recent release:

def shared_pods
    pod 'Moya', '13.0.1' #Alamofire wrapper
    pod 'AlamofireNetworkActivityLogger', '~> 2.0'
    pod 'AlamofireObjectMapper'
    pod 'ReachabilitySwift', '~> 4.0'
    pod 'SDWebImage', '~> 4.4.5'
end

Edit

However, as you mentioned in your edit, all your another pod dependencies are incompatible with tvOS:

[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `DynamicCodable (1.0)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `Stripe (15.0.1)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `GooglePlacesSearchController (0.2.1)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `Google-Mobile-Ads-SDK (7.41.0)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `NTMonthYearPicker (1.0.0)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `FLAnimatedImage (1.0.12)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `NYTPhotoViewer (1.1.0)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `MGSwipeTableCell (1.6.9)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `SendBirdSDK (3.0.154)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `RSKImageCropper (2.2.3)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `ActiveLabel (1.0.1)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `FSCalendar (2.8.0)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `GooglePlaces (3.5.0)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `CreditCardValidator (0.4)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `FittedSheets (1.4.5)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `Branch (0.29.1)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `CarbonKit (2.3.1)`, which does not support `tvOS`.
[!] The platform of the target `tvApp` (tvOS 9.0) is not compatible with `AWSS3 (2.12.0)`, which does not support `tvOS`.

To check the compatibility, you can open the pod repository and check the .podspec file. For example, the Stripe .podspec doesn't have a tvos.deployment_target.

You can't use frameworks that are incompatible with a project target.

Upvotes: 2

rodskagg
rodskagg

Reputation: 3937

I think the error is quite clear? "The platform of the target TVApp (tvOS 9.0) is not compatible with Stripe, which does not support tvOS." Stripe doesn't seem to run on tvOS, which means you can't use it.

Upvotes: 1

denis_lor
denis_lor

Reputation: 6547

From Stripe documentation https://stripe.com/docs/mobile/ios it says:

The library is compatible with iOS 9.0 and up

That's why it doesn't work for your tvos platform target.

Upvotes: 1

Related Questions