Hi I am looking for a way to perform a database fetch at start up and keep those items in an array.
My solution, although crude was to create an extern variable in viewDidFinishLaunchingWithOptions
I used
appdelegate.h
extern NSArray *listArray;
then
appdelegate.m
NSArray *listArray;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
listArray = [self createGlobalArray];
//other startup code, etc...
The problem is that when I go to any view controller and for example in viewdidload I say
VC1.m
-(void)viewDidLoad{
myVCArray = [NSArray arrayWithArray:listArray];
}
I get two errors: Apple Match-O linker error (directory not found…)
How do i fix this error?
Also is there a better way to do this?
Thank you
Usually linker errors are because things aren’t being properly included in your build settings somewhere. I’d make sure that Build Phases > Compile Sources as well as Build Phases > Linked Libraries contain all the files your project needs.