Warning: unnecessary check for minimum deployment target Warning: unnecessary check for minimum deployment target ios ios

Warning: unnecessary check for minimum deployment target


Found an ugly workaround to silence warning, but I hope there is a better way:

In iOS 8+ targets build settings, I defined a precompile flag in Build Settings -> Swift Compiler - Custom Flags -> Other Swift Flags:

-D iOS8target

Then I changed code to this way:

#if iOS8target    // iOS 8+ compatible code#else    if #available(iOS 8.0, *) {        // repeat iOS 8+ compatible code again!    } else {        // iOS 7 code    }#endif

It's not refactored and ugly, but it works!

UPDATE:There is a swift compiler switch -suppress-warnings to omit all warnings. But it also suppress useful warnings.Also if there is only one specific file which emits warnings, you can use -w flag in Building Phases pane. It will also suppress useful warnings but limited to one file.


The next release of Cocoapod (after 0.39.0) should have this issue addressed. Check this for more details.


Please check your deployment target into your General and set from 9.0 to 7.0 or less. this warning will remove automatically.