Warnings for API calls that won’t work in iOS 3

When you build for iOS 4 you don’t get warnings for API calls that don’t exist in iOS 3 so it can be hard to see when it’s going to crash.

In order to get warnings for that usage you can edit /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/include/AvailabilityInternal.h, you have to update that URL for the appropriate SDK version, and this is only for the simulator.

First change the ownership or write permissions so you can edit it. Then edit the file.

Find this line:

#define __AVAILABILITY_INTERNAL_WEAK_IMPORT        __attribute__((weak_import))

and change it to:

#define __AVAILABILITY_INTERNAL_WEAK_IMPORT        __attribute__((weak_import,deprecated))

When you compile you’ll now get deprecation warnings for all API usage that won’t work in iOS 3.

This was posted 1 year ago. It has 0 notes.