Vik*_*ech 8 xcode frameworks objective-c ios cocoapods
有什么方法可以通过podfile为单个目标添加多个平台支持吗?
例如,我的项目在iOS和Mac上都是通用的。它们使用相同的代码库。因此,我没有为同一代码创建多个目标,而是在同一目标中添加了对iOS和MacOSX的支持。它构建良好。
现在,我想通过Cocoapods添加一个依赖项。我创建一个podfile并指定目标对pod的依赖。这里讨论的豆荚以类似的方式支持多个平台,即单个目标。
但是现在在构建我的项目时,它在iOS上失败了。
在Podfile中为单个目标指定多个平台会产生错误。
如果我仅将平台指定为iOS或Mac,则该项目无法在其他平台上构建。
有谁之前经历过这个吗?如何通过podfile为单个目标添加多个平台?
PS-我知道可以通过在项目中创建多个目标来实现这一目标。但我想保留它作为我的最后选择。
Pra*_*tel -3
我在我的一个有 3 个目标的项目中做了同样的实现。我创建了“def”共享 pod,然后在所有 3 个目标中调用此共享 pod。这样一来,效果就相当不错了。我只为 iOS 应用程序做了。
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
def shared_pods
pod 'Stripe'
pod 'Google/SignIn'
end
target 'App_Dev' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
shared_pods
end
target 'App_QA' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
shared_pods
end
target 'App_Release' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
shared_pods
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
392 次 |
| 最近记录: |