(ストーリーボードを使用して)アプリを作成しようとしていますが、イベントを追加したいと思います。私のMapViewController.hには次のものがあります。
#imports
extern NSMutableArray* events;
@interface MapViewController : etc, etc{
..
}
したがって、私が欲しいのは、この.hファイルをたとえば私のAppDelegate.mファイルにインポートし、そこにappDidFinishLoadingで次のようなことを実行できるようにすることです。
Event *event = [[Event alloc] init];
event.blabla = blabla;
...
[events addObject:event];
同時に、MapViewController.mで、これらのイベントをMKMapView(mapviewcontrollerで定義され、worldViewと呼ばれる)に追加する関数が必要です。
それで:
@implementation MapViewController.m
-(void)setEvents{
for(int i = 0; i<[events count]; i++)
[worldView addAnnotation:[events objectAtIndex:i]];
}
...
ご想像のとおり、ビルドのリンク部分で失敗し、次のエラーが発生します。
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)
だから..うん..助けてください^^