And*_*nov 43 xcode ios cocoapods xcode7
我使用CocoaPods来管理项目中的依赖项.我写过Podfile:
target 'MyApp' do
platform :ios, '8.0'
# Uncomment this line if you're using Swift or would like to use dynamic frameworks
#use_frameworks!
# Pods for MyApp
pod 'KeepLayout', :git => 'https://github.com/iMartinKiss/KeepLayout', :tag => 'v1.6.0'
pod 'EasyMapping'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Run Code Online (Sandbox Code Playgroud)
这个文件适用于CocoaPods 0.x,但是在我更新到CocoaPods 1.0后我无法编译项目.我跑完之后
pod update
Run Code Online (Sandbox Code Playgroud)
我无法编译我的项目错误:
/Users/<...>/Pods/KeepLayout/Sources/KeepAttribute.m:195:1:无法合成弱属性,因为当前部署目标不支持弱引用
我已经看到每个库都使用不同的部署目标进行构建.例如,使用4.3部署目标构建KeepLayout.
我如何确定每个pod依赖项的构建目标?
Ale*_*uda 97
虽然CocoaPods的一些开发版本(以及1.0之前的版本)可能已将项目的部署目标传播到pod,但1.0中不再是这种情况.要解决此问题,当前的开发人员建议使用安装后挂钩.
这是一种强制方法,用于强制生成的Pods项目中每个pod的硬编码部署目标.粘贴在你的结尾Podfile:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.2'
end
end
end
Run Code Online (Sandbox Code Playgroud)
Yan*_*eez 23
以下是为 pod 目标永久设置部署目标的方法。
转到 -> podfile -> 添加以下代码
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = "12.0"
end
end
endRun Code Online (Sandbox Code Playgroud)
Daw*_*ong 22
因为"荚" 项目已设置部署目标,你只需要删除部署目标每个构建的目标.将此附加到您的结尾处Podfile
post_install do |lib|
lib.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
Run Code Online (Sandbox Code Playgroud)
灵感来自github帖子和Alex Nauda的答案.
Ahm*_*san 12
虽然Alex Nauda接受的答案很好,但让 Pod 从应用程序继承目标可能是更好的解决方案。
app_ios_deployment_target = Gem::Version.new('9.2') # Change to your current deployment target
platform :ios, app_ios_deployment_target.version
# Let Pods targets inherit deployment target from the app
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/4859
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
pod_ios_deployment_target = Gem::Version.new(configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
if pod_ios_deployment_target <= app_ios_deployment_target
configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
end
Run Code Online (Sandbox Code Playgroud)
Swift 5 简单解决方案将以下代码复制粘贴到 podFile 的末尾
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.1' #set your minimum version your all pods will set to mininum 13.1 version :-)
end
end
end
Run Code Online (Sandbox Code Playgroud)
安装你的 Pod
//MARK: - Run the command in your terminal
pod install
Run Code Online (Sandbox Code Playgroud)
快乐编码
1)搜索IPHONEOS_DEPLOYMENT_TARGET
2)更改iOS部署目标
| 归档时间: |
|
| 查看次数: |
17141 次 |
| 最近记录: |