I made my way through some code for two days, trying to understand why I could not get the global variable NSMutableArray, declared in .h and implemented in .m, and set the viewDidLoad function.
It finally dawned on me: in Objective-C there is no such thing as a global variable, at least not in the sense of PHP that I learned about. I never read Xcode error warnings, but it was, even if not quite plain English: "Blah" instance variable, available in the class method.
My question is: what should I do now? I have two view controllers that need to access the central NSMutableDictionary, which I generate from the JSON file at the URL. This is basically an extended menu for all my abbreviations in Table View, and I would like to have a couple of other "global" (non-static) variables.
Do I need to pick up JSON every time I want to generate this NSMutableDictionary, or is there a way to set it once and access it from different classes via #import? Should I write data to a file, or is there another way people usually do this?
buley
source share