How to fix "Use of undeclared identifier 'NSFoundationVersionNumber_iOS_6_1'" error in Xcode 5

- by

This can happen when you try to run code built for iOS 7 Base SDK on Xcode 4.x, or if you compile against an older Base SDK in Xcode 5.

The solution is to define what isn’t defined manually using a Macro. Add this to every class that’s complaining and you should be fine:

#ifndef NSFoundationVersionNumber_iOS_6_1
#define NSFoundationVersionNumber_iOS_6_1 993.00
#endif

This tells the compiler to define the value if it’s not there, so it has no reason to complain.

Full list of all version numbers in Apple’s Foudation Constants Reference Guide:

How do I know that I’ve got more than one Base SDK?

You can check this either by connecting a device, and see if it appears twice. If it does, then it means Xcode lets you choose which SDK to compile against (the newest one is at the bottom):

Screen Shot 2013-11-12 at 16.15.02

Alternatively you can check under Build Settings, find a drop-down menu called Base SDK. I’ve explained more about how to install an older Base SDK here: http://pinkstone.co.uk/how-to-use-ios-6-legacy-look-in-xcode-5/

Kudos to this unrelated thread on GitHub:



If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.