Is there any way to check the Objective-C version that I am using in my App
-
Did you mean OS version? You can check system version using these `[[UIDevice currentDevice] systemVersion]` – Kampai Jun 03 '16 at 07:43
-
Why you want in Xcode? What to do with that? – Ekta Padaliya Jun 03 '16 at 08:01
-
Check the Objective-C compiler you are using in your Build Settings – KIDdAe Jun 03 '16 at 08:02
-
Does the [Objective-C Feature Availability Index](https://developer.apple.com/library/ios/releasenotes/ObjectiveC/ObjCAvailabilityIndex/) help? – Ken Thomases Jun 03 '16 at 10:10
-
see this for help: [Runtime Versions and Platforms](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html) – Anbu.Karthik Sep 19 '19 at 10:41
2 Answers
The Objective-C level of language support is defined by the version of Clang used to compile the code, which is itself very close to the version of Xcode.
#if __clang_major__ >= 11
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 11.x can support.");
// This language version supports the additional features/fixes written under "Apple Clang Compiler"
// https://developer.apple.com/documentation/xcode_release_notes/xcode_11_release_notes
// Notably this version adds Objective-C support to:
// - `[[clang::no_destroy]]` and `[[clang::always_destroy]]`
#elif __clang_major__ >= 10
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 10.x can support.");
// This language version supports the additional features/fixes written under "Apple Clang Compiler"
// https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes
// Notably this version adds macro support to:
// - detect most builtin pseudo-functions with `__has_builtin`
#elif __clang_major__ >= 9
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 9.x can support.");
// This language version supports the additional features/fixes written under "Apple LLVM Compiler and Low-Level Tools"
// https://developer.apple.com/library/archive/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW878
// Notably this version adds Objective-C support for:
// - the `@available` language feature
#elif __clang_major__ >= 8
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 8.x can support.");
// This language version supports the additional features/fixes written under "Objective-C and C++"
// https://developer.apple.com/library/archive/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW78
// Notably this version adds Objective-C support for:
// - the `@property (class)` language feature
#elif __clang_major__ >= 7
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 7.x can support.");
// This language version supports the additional features/fixes written under "Objective-C"
// https://developer.apple.com/library/archive/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW326
// Notably this version adds Objective-C support for:
// - `CF_RETURNS_NOT_RETAINED` and `CF_RETURNS_RETAINED`
// - `__kindof`
// - `_Nullable`, `_Nonnull`, and `_Null_unspecified`
// - Lightweight generics like `NSArray<UIImage *> *` and `NSDictionary<NSString *, NSURL *>`
#elif __clang_major__ >= 6
NSLog(@"My Objective-C language support is what Apple Clang/Xcode 6.x can support.");
// This language version supports the additional features/fixes written at:
// https://developer.apple.com/library/archive/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html#//apple_ref/doc/uid/TP40001051-CH1-SW453
#else
NSLog(@"My Objective-C language support is so old that I won't even be allowed to publish this on any App Store nowadays.");
#endif
You may also use __clang_minor__
if you need more precision for the version being used.
Whenever possible, it is advised to use __has_builtin
to check the availability of Objective-C language features instead of __clang_major__
and __clang_minor__
.
Some notable other older historical language features that you shouldn't even bother testing for availability anymore:
NS_ENUM
andNS_OPTIONS
were added in Xcode 4.5NSDictionary
andNSArray
subscripting were added in Xcode 4.4 / 4.5@YES
and@NO
literals were added in Xcode 4.4 / 4.5NSNumber
,NSDictionary
andNSArray
literals were added in Xcode 4.4@autoreleasepool
blocks were added in Xcode 4.2- "Objective-C 2.0" is something VERY old (Xcode 2.x)
Lastly "Modern Objective-C" just refers to any currently available Xcode support for Objective-C.
Related:

- 37,241
- 25
- 195
- 267
There are two versions of the Objective-C runtime—“modern” and “legacy”. iPhone applications and 64-bit programs on OS X v10.5 and later use the modern version of the runtime.check here
All major features introduced in objective-c, You can check here

- 380
- 3
- 12