Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way for Xcode to warn about new API calls?

On more than one occasion I've seen crashing bugs appear on iOS 3.x due to use of a new call that was introduced in 4.x without proper checking.

Is there a way for Xcode to warn about classes, methods and procedures that are only available a later version than the deployment target?

That way I could easily list through all the code and make sure it's properly conditionalized.

like image 714
Ben S Avatar asked Jan 13 '11 01:01

Ben S


People also ask

What is API Xcode?

The Xcode Server API Reference is the underlying interface for Xcode Server. Note. For detailed information about installing and using Xcode Server, see Xcode Server and Continuous Integration Guide.

Does Apple have an API?

The Sign in with Apple REST API is a web service that connects you to Apple's authentication servers. Use this service to generate and validate the identity tokens used to verify a user's identity. To sign in from a web app or other platform, like Android, use Sign in with Apple JS.

What is API in Swift IOS?

Also known as Application Programming Interface is a set of protocols and functions used in software to help interact with other software.


Video Answer


1 Answers

I've actually released something which helps with testing this sort of thing. It's part of my MJGFoundation set of class called MJGAvailability.h.

The way I've been using it is to apply it in my PCH file like this:

#define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_4_0 #import "MJGAvailability.h"  // The rest of your prefix header as normal #import <UIKit/UIKit.h> 

Then it'll warn (with perhaps a strange deprecation warning) about APIs which are being used that are too new for the target you set as the "soft max" as per the #define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED. Also if you don't define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED then it defaults to your deployment target.

I find it useful because I can then double check which APIs I'm using that are too new for the deployment target that I've set.

like image 137
mattjgalloway Avatar answered Sep 20 '22 21:09

mattjgalloway