I don’t think I’m giving any Apple secrets away here, so I’ll ask.
My .pch file looks like this:
#ifndef __IPHONE_4_0
#warning "This project uses features only available in iOS SDK 4.0 and later."
#endif
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import <Availability.h>
#import <UIKit/UIKit.h>
#import "DejaViewAppDelegate.h"
#endif
So, a warning appears on line 2 that says “This project uses features only available in iOS SDK 4.0 and later.”.
The SDK warning is echoing the ifndef warning when #import Availability.h comes AFTER the ifndef statement.
It does NOT throw a warning when the #import Availability.h BEFORE the idndef.
Any reason why?
In the standard project template,
<Availability.h>is the first import. That makes sense because that’s where__IPHONE_4_0is defined.The macro at the top checks if
IPHONE_4_0is defined and issues a compiler warning if it’s not. As the macro is defined later (by importing<Availability.h>, you see the compiler warning.