看見警告就煩
有時候還錯過了彌補的機會
不能容許
一岂贩、 屏蔽指定警告
比如:新版本Xcode的Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)警告幌衣,OC之前的舊代碼一般都不想去修改斑芜。如果是第三方庫的代碼碗殷,也不想去修改精绎。
這個時候選擇屏蔽是最好的選擇。
1. 右鍵警告锌妻,選擇“Reveal in Log”
2. 查看警告的類型
圖中的警告為
-Wnullability-completeness
代乃。
3. 屏蔽指定警告類型
添加
-Wno-nullability-completeness
不顯示此警告。
類似的警告就會消失了仿粹。
二搁吓、清除模擬器部署版本警告
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.
看到這個警告一般會在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
來加快編譯的速度。
會出現(xiàn)undefined method
targets' 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
因為使用了install! 'cocoapods', :generate_multiple_pod_projects => true, :incremental_installation => true
后贮预,每一個工程的部署版本比較低,會出現(xiàn)
點擊更新后顯示
指定目標(biāo)版本為契讲,明顯不是我們希望的仿吞。
這個時候只能
點擊Done,此警告消失捡偏。再次編譯并不會再提示了唤冈。但是當(dāng)?shù)谌綆斓陌姹旧壓螅尉鏁俅纬霈F(xiàn)银伟。
// END 等有新的警告再繼續(xù)你虹。