How-to: Silence individual warnings for select cocoapods2018-01-18
As usual, Xcode 9 introduced new default warnings and tightened existing ones. Some of these changes don’t seem to get applied to existing projects during the upgrade check. For better or worse though, running
pod install or
pod update has the effect of setting warnings for all pods like it’s a new project. This led to me seeing a lot of warnings in the form of
'RandomCocoaTouchAPI' is only available on iOS 10.0 or newer in certain pods. The build setting responsible is
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE.
Since there’s no telling when these warnings are going to be fixed, if ever, I used the following
post_install snippet in my Podfile to manually relax just this setting on the offending pods. It’s a better solution than suppressing all warnings. It also prints out a notice to remind me to check later if the warnings have been fixed.
If you don’t care to enumerate individual pods, you can also change the setting at the pod project level.