3

Recently I updated my Xcode to 6.3(sdk iOS8). I am using one API of NSString called "containsString" which is available from iOS 8.0 onwards. But my deployment target is 7.0 and this API is not available on iOS7. App is running fine on iOS8, however it was crashing on iOS7 since it did not find that API.

Now ideally Xcode should have given me warning since the API is not available on deployment target (iOS7).

Is there a way to make xcode give warning or even build error if the API is not supported on minimum supported iOS version?

I would prefer if anyone has way to do it using pre compiled headers.

Aditya Gaonkar
  • 660
  • 6
  • 13

1 Answers1

0

Try this:

"#warning" this will create a user defined warning and will be highlighted in yellow as a normal warning.

example "#warning warningMessage".

  • 1
    But how does this work, i want to check condition and then display a message. Condition is "Is there a way to make xcode give warning or even build error if the API is not supported on minimum supported iOS version?". For example this API -- (BOOL)containsString:(NSString *)aString NS_AVAILABLE(10_10, 8_0);......i want to check that NS_AVAILABLE condition. – Aditya Gaonkar Aug 03 '15 at 05:23