1
vote
1answer
37 views

uninitialized extern NSString usage

In the following class: MGTileMenu various extern NSString's are defined in the following way for use as notifications: .h extern NSString *MGTileMenuWillDisplayNotification; // menu will be shown ...
0
votes
7answers
77 views

-[__NSCFString stringInISO8601Format]: unrecognized selector sent to instance [closed]

I create one extern NSString* select_new and initialize it in main() class. NSString* select_new = @"new_car"; but when I use it [carObject getCar:[[self ...
0
votes
1answer
98 views

Extern inheritance duplicate symbol errors, what is going on?

I have a question about the use of extern and inheritance. I'm coding an iOS app in Objective C using X-Code. I have two hypothetical classes B and C which both inherit from class A. Now class A ...
0
votes
2answers
176 views

Equivalent of public static final variables

I understand that placing the word extern before a variable declaration in a header file declares the existence of a global static variable without initialising it. I also understand that if I import ...
1
vote
2answers
85 views

Xcode: extern causing Linker error

Seems to be almost a duplicate of this question, but the answer there hasn't addressed the problem. first.h extern PlanningDocumentService *folderService; first.m #import first.h - ...
0
votes
1answer
94 views

C++ Standard regarding external linkage and calling conventions

I've read the last C++11 draft (n3337 - is it the last one?), and I got a question for a possible implementation I've been working on. Let's say we have this code: extern "Objective C" { class ...
0
votes
2answers
91 views

When & where to initialize extern variables from arbitrary message return values?

The project I am working on stores some constant strings like this: (.h) extern NSURL *kURLLocationComputer; And I need to initialize them as follows: (.mm) NSURL *kURLLocationComputer; ... { ...
2
votes
1answer
124 views

Objective-C – access extern const with a string containing its name?

I have a constant defined out of class in SomeClass.h: extern NSString *const SCImportantString; @interface SomeClass @end And assign it in SomeClass.m: NSString *const SCImportantString = @"All ...
1
vote
2answers
98 views

Accesing global variable giving linker error in objective C

I have declared a global variable like below extern NSString *name; @interface viewcontrollerOne{} in implementation file i am accessing that global variable in some method like -(void)someMethod ...
2
votes
1answer
1k views

type name does not allow storage class to be specified

@interface Foo : NSObject { extern int gGlobalVar; int i; } -(void)setgGlobalVar:(int)val; @end @implementation Foo -(void)setgGlobalVar:(int)val { i = 5; NSLog(@"i = %i", ...
8
votes
2answers
904 views

Static, extern and inline in Objective-C

What do static, extern and inline (and their combinations) mean in Objetive-C using the LLVM compiler? Also, I noticed that there are CG_EXTERN and CG_INLINE macros. Should we be using those instead? ...
2
votes
2answers
284 views

setting NSMutableArray Global variable

I want a NSMutableArray global. I have the following setup: code.h extern NSMutableArray *global @interface @end code.m NSMutableArray *global=nil; @implementation ... global=variable_mutablearray; ...
0
votes
1answer
47 views

extern passing data from one instance to another of a different class

I have the following code in objective C: class1.h: ... extern NSString global; ... class1.m: ... NSString *global; @implementation: .. -dostuff{ global=@"hi"; } .. @end ...
1
vote
1answer
365 views

Objective-C extern and typedef undefined symbols

I am new to objective-c. I have the following: @interface HPSEnumerations : NSObject typedef NSString* HPS_FORMELEMENTTYPE; extern HPS_FORMELEMENTTYPE Textfield; extern HPS_FORMELEMENTTYPE Label; ...
40
votes
1answer
2k views

“FOUNDATION_EXPORT” vs “extern”

I would like to ask what's the reason behind using FOUNDATION_EXPORT instead of extern in Objective C projects. I've checked this question and using FOUNDATION_EXPORT has earned whopping 340 points ...
0
votes
1answer
145 views

Passing an NSString to another view controller crashes the app

I have the following code where I am passing the value of buttonString (an NSString) to another view controller. the app crashes when buttonString = imageName; is set and then called on the other view ...
1
vote
2answers
235 views

Trying to use extern int, told it's now a pointer

I've declared this little guy in the Constants.h file of my project: extern int *exitDirection; Then, I set him to an integer. In this case, it was 881, which is a very nice number. Now, I want to ...
3
votes
1answer
1k views

How to use static variable(BOOL) in Objective C

I am from C# background, and I am having a hard time in figuring out about how to use a static variable(BOOL in my case) in Objective C. My questions are: Where should I declare my static variable. ...
0
votes
1answer
162 views

Duplicate symbol caused by inline extern

FMParallaxChild.h typedef struct { // ... } FMParallaxSetting; inline extern FMParallaxSetting FMParallaxSettingMake(CGPoint ratio, CGPoint startPos, CGPoint offset, CGPoint relVel, int zOrder); ...
2
votes
2answers
619 views

Objective-c extern variables changes

Please help, I'm stuck with objective-c global variables aka extern! I writing my first iOS app it is a game, so to save my progress I wrote some global variables in Globals.h: @interface Globals : ...
0
votes
1answer
340 views

Is it true to use extern to access variables from other classes in Objective c?

i have a DetailViewController and a Messages class(this is a TableViewController class). I parse some web information in the first class and want to use some values amongst them in the second class. ...
1
vote
3answers
684 views

Difference between external variable of some sort and static variable

What the difference between external variable of some sort and static variable? //ClassA.m NSString *var1; static NSString *var2; @implementation ClassA ...
7
votes
4answers
5k views

Objective-C static, extern, public variables

I want to have a variable that I can access anywhere by importing a header file but I also want it to be static in the sense that there is only one of them created. In my .m file, I specify static ...
0
votes
2answers
2k views

Linker error using extern “C” in Objective-C code

I'm trying to create some utility functions that can be called from both Objective-C and C++ code in an iPhone application. I have third party C++ classes that cannot be compiled as ObjectiveC++ ...
7
votes
2answers
1k views

3 questions about extern used in a Objective-C project

1 when I use the word "extern" before a method or variable declaration, am I making it global and therefore readable/writable/usable over the entire project ? 2 If I use extern before a keyword, is ...
7
votes
1answer
2k views

“extern const” vs “extern” only

I've seen 2 ways of creating global variables, what's the difference, and when do you use each? //.h extern NSString * const MyConstant; //.m NSString * const MyConstant = @"MyConstant"; and //.h ...
3
votes
3answers
2k views

External Constants for UIColor, UIFont, etc

I have a constants.m file that is a centralized collection of many program constants. To set a color, I do this: @implementation UIColor (UIColor_Constants) +(UIColor *) ...
2
votes
2answers
459 views

Linking External Constants — Objective C

In an earlier answer about external constants, the preferred answer says "Constants.m should be added to your application/framework's target so that it is linked in to the final product." I am ...
1
vote
2answers
341 views

Mysterious problem with Extern

In my project I've AuxState.h where I define extern NSString *kStrAgentStateLogin; extern NSString *kStrAgentStateAvailable; extern NSString *kStrAgentStateLogOff; extern NSString ...
0
votes
2answers
165 views

Calling external method actually calls other method

I must be asleep already or something because I'm seeing weird things. I've got a class, called ListSorter (.h/.m), which has 2 extern methods. The .h looks like: @interface ListSorter : NSObject ...

1 2
15 30 50 per page