Global variable in Objective C IPhone -


i load few variables in appdelegate class. declared in .h file.

i have global.h file declares same vars extern, such as:

appdelegate.h

nsstring *dbname; 

global.h

extern nsstring *dbname; 

i haven't found pattern yet, of classes include global.h var nil.

any idea doing wrong?

edit:

it looks vars like:

int x; 

stick , available, vars pointers lost:

nsstring *name; 

they loaded db in appdelegate.

i tried declaring

char name[30]; 

then assigning , good.

now what?

in .h:

 extern nsstring *global; 

in .m somewhere:

 nsstring *global = @"foobar"; 

if need set global @ runtime, you'll have in method somewhere; say, applicationdidfinishlaunching:.


where assigning global in nsstring case? , when retaining value? mean "lost"?

note variable must not declared in .h; extern goes in .h, nsstring *global; must in 1 , 1 .m file.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -