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.

post_install do |installer|
  # Manually relax CLANG_WARN_UNGUARDED_AVAILABILITY for some pods temporarily
  unguardedAvailabilityTargets = ['FBSDKCoreKit']
  installer.pods_project.targets.each do |target|
    if unguardedAvailabilityTargets.include? target.name
      target.build_configurations.each do |config|
        config.build_settings['CLANG_WARN_UNGUARDED_AVAILABILITY'] = 'YES'
      end
      puts "CLANG_WARN_UNGUARDED_AVAILABILITY was set to YES for #{target.name}"
    end
  end
end

If you don’t care to enumerate individual pods, you can also change the setting at the pod project level.

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings['CLANG_WARN_UNGUARDED_AVAILABILITY'] = 'YES'
    puts "CLANG_WARN_UNGUARDED_AVAILABILITY was set to YES for all pods"
  end
end