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

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:





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.