// *** before: ***
// the header told the compiler about the types, and the linker knew nothing
// about them. The framework had to be added to the target by hand
#import <MapKit/MapKit.h>
@implementation MapScreen
- (void)show {
MKMapView *map = [[MKMapView alloc] initWithFrame:CGRectZero];
[self.view addSubview:map];
}
@end
// forget to add MapKit to "Link Binary With Libraries" and the code
// compiles cleanly, then fails at the very end of the build:
// Undefined symbols for architecture arm64: _OBJC_CLASS_$_MKMapView
// *** in version 2013: ***
// the module description carries the name of the library to link, so
// importing it is enough
@import MapKit;
@implementation MapScreen
- (void)show {
MKMapView *map = [[MKMapView alloc] initWithFrame:CGRectZero];
[self.view addSubview:map];
}
@end
// nothing has to be added to the target: the compiler records the request
// to link MapKit in the object file, and the linker obeys it. A framework
// that is no longer imported stops being linked as well