
看見(jiàn)警告就煩
有時(shí)候還錯(cuò)過(guò)了彌補(bǔ)的機(jī)會(huì)
不能容許
一、 屏蔽指定警告
比如:新版本Xcode的Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)警告,OC之前的舊代碼一般都不想去修改。如果是第三方庫(kù)的代碼,也不想去修改。

這個(gè)時(shí)候選擇屏蔽是最好的選擇。
1. 右鍵警告,選擇“Reveal in Log”

2. 查看警告的類型

圖中的警告為
-Wnullability-completeness。
3. 屏蔽指定警告類型

添加

-Wno-nullability-completeness不顯示此警告。
類似的警告就會(huì)消失了。
二、清除模擬器部署版本警告
The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.4.99.
看到這個(gè)警告一般會(huì)在Podfile的最底部添加
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '8.0'
end
end
end
但是在新版本cocoapods中使用了新特性 install! 'cocoapods', :generate_multiple_pod_projects => true, :incremental_installation => true來(lái)加快編譯的速度。
會(huì)出現(xiàn)undefined methodtargets' for nil:NilClass`的提示,targets找不到了。使用新的方式
post_install do |installer|
installer.pod_target_subprojects.flat_map { |p| p.targets }.each do |t|
t.build_configurations.each do |c|
c.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
end
end
end
完美的解決。
三、 清除validate project settings
因?yàn)槭褂昧?code>install! 'cocoapods', :generate_multiple_pod_projects => true, :incremental_installation => true后,每一個(gè)工程的部署版本比較低,會(huì)出現(xiàn)

點(diǎn)擊更新后顯示

指定目標(biāo)版本為,明顯不是我們希望的。
這個(gè)時(shí)候只能

點(diǎn)擊Done,此警告消失。再次編譯并不會(huì)再提示了。但是當(dāng)?shù)谌綆?kù)的版本升級(jí)后,次警告會(huì)再次出現(xiàn)。
// END 等有新的警告再繼續(xù)。