USING #define:
you cannot debug id value
Working with # define and other macros is a Pre-Processor job. When you first click Build / Run, it will process the source code, it will work with all macros (starting with the # character),
Suppose you created
#define LanguageTypeEnglish @"en"
and used it in two places in your code.
NSString *language = LanguageTypeEnglish; NSString *languageCode = LanguageTypeEnglish;
it will replace "LanguageTypeEnglish" with @"en" in all places. This way 2 copies of @"en" will be created. iee
NSString *language = @"en"; NSString *languageCode = @"en";
Remember that before this process, the compiler is not in the picture.
After pre-processing all the macros, the compiler enters the image and it gets an input code like this,
NSString *language = @"en"; NSString *languageCode = @"en";
and compile it.
USING static:
It respects the scope and is safe in type. you can debug id value
During compilation, if a compiler is found,
static NSString *LanguageTypeRussian = @"ru";
then it checks whether the variable with the same name has been previously saved, if so, it will pass the pointer to this variable, if not, it will create this variable and pass it to the pointer, next time it will only pass the pointer of the same.
Thus, using static, only one copy of the variable is created within the scope.