我想在iOS和tvOS上使用相同的pod。为此,我在 pod 文件中编写了这样的代码,
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
但是我得到错误The platform of the target TVApp (tvOS 9.0) is not compatible with Stripe, which does not support tvOS.
其他豆荚,如,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'
也与 tvOS 不兼容,但我想在 tvOS 中使用它们。
如何为两个操作系统使用相同的框架?
Moya pod 与 tvOS 兼容,正如您可以在其 .podspec 文件中看到的那样:
s.tvos.deployment_target = '9.0'
我尝试使用您的 .podspec 配置运行一个项目,并在过时的Moya
子依赖项"Result", "~> 3.0"
中遇到了一些问题。但是,在最新版本中,此依赖项已更新为"Result", "~> 4.1"
,并且我能够在iOS 9.0 tvOS上成功运行Moya。
尝试使用最新版本:
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
编辑
但是,正如您在编辑中提到的,所有其他 pod 依赖项都与 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`.
要检查兼容性,您可以打开 Pod 存储库并检查.podspec
文件。例如,Stripe .podspec 没有tvos.deployment_target
。
不能使用与项目目标不兼容的框架。
从Stripe
文档中 https://stripe.com/docs/mobile/ios 它说:
该库与
iOS
9.0 及更高版本兼容
这就是为什么它不适用于您的tvos
平台目标。
我认为错误很清楚吗?"目标TVApp(tvOS 9.0(的平台与不支持tvOS的Stripe不兼容。Stripe 似乎无法在 tvOS 上运行,这意味着您无法使用它。