I'm trying to make an app (using storyboard) and I want to populate it with events. In my MapViewController.h I have:
#imports
extern NSMutableArray* events;
@interface MapViewController : etc, etc{
..
}
So what I want is to be able to import this .h file in, for example, my AppDelegate.m file and in there in appDidFinishLoading do stuff like:
Event *event = [[Event alloc] init];
event.blabla = blabla;
...
[events addObject:event];
and at the same time in my MapViewController.m I want a function that adds these events to my MKMapView (which is defined in my mapviewcontroller and called worldView)
so:
@implementation MapViewController.m
-(void)setEvents{
for(int i = 0; i<[events count]; i++)
[worldView addAnnotation:[events objectAtIndex:i]];
}
...
As you might have guessed, it's failing during the linking part of the build with the following errors:
Undefined symbols for architecture armv7:
"_events", referenced from:
-[AppDelegate applicationdidFini... ]
-[MapViewController setEVents] in ...
..
clang: error: linker command failed with exit code 1 (use -v to see invocation)
So.. Yeah.. Please help ^^