XCode setting to see code which won't work on previous OS versions

I've written an app specifically for iOS7, and am now attempting to make it work for iOS6.

I'd really like a setting to enable warnings which highlight lines of code which won't work on iOS6. i.e. any calls to code which ONLY work on iOS7.

That way I can immediately identify any lines of code which I need to attend to before catching them during debugging.

Does this even exist?


There is two option to deal with this.

  1. Use MJGAvailability, a drop in header file and it will make warnings if a selector is "too new".
  2. Buy Delpoymate, it can scan your Xcode project and show you any incompatible calls.

If you use an older Xcode next to the newest, than use this snippet:

if ([self respondsToSelector:@selector(newSelector)]){
#if __IPHONE_7_0
      [self newSelector];
} else {
      [self oldSelector];

There is no way of getting a warning to appear and even if there was how would the IDE now that you would have done something to handle it like the below

if([myObject respondsToSelect:@selector(myiOS7SelectorOnly)]) {
    [myObject myiOS7SelectorOnly];

It works the other way if you where developing an app for iOS7 and you used a deprecated method that iOS7 API doesn't use any more it would give you a warning but not the other way you will have to wait for it to turn around and crash and throw an unrecognised selector exception.

At some point I had 2 Xcode installed - Xcode 4 and Xcode 5. Xcode 4 did not have API for ios7 and it was showing all incompatibilities. But I don't know where can you find XCode4 now and will it still show errors in ios7 code or not? At least you can try this way.

Need Your Help

How to remove arrow in UITableView

ios objective-c uitableview

I am working on a UITableView. Please tell me how to remove the arrow button displayed in the each and every row?

WPF datagrid: converter and StringFormat

c# wpf .net-3.5

I have a standard (WPF toolkit) data grid. Some of the columns (which are explicitly defined) have to be shown as percentages. Some columns have to be shown in red if the values are below 0. (Th...