How to declare and use global variable with extern in Objective C and other files.
I want to define and assign the global variable in 1.h file and 1.m and want to use that in 2.m file
I am defining
1.h
extern const NSString *str;
1.m
NSString *str=@"HELLO";
in 2.m I am importing the 1.h
want to access str but giving me 2.o error.
If these are application settings you should consider using NSUserDefaults. If it’s constants, you should define them in prefix header file.