I'm following along with the iOS MapView example.
I created a new Objective-C .m file in Project/ProjectFolder/RCTMapManager.m, and added the following code:
// RCTMapManager.m
#import <MapKit/MapKit.h>
#import "RCTViewManager.h"
@interface RCTMapManager : RCTViewManager
@end
@implementation RCTMapManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[MKMapView alloc] init];
}
@end
I then opened up atom and created a js file in components/MapView.js and added the following code:
// MapView.js
import { requireNativeComponent } from 'react-native';
// requireNativeComponent automatically resolves this to "RCTMapManager"
module.exports = requireNativeComponent('RCTMap', null);
And ran the build command in Xcode to rebuild my previously working project, and the build failed with the error message:
So I then commented out everything in MapView.js, and commented out the implementation in RCTMapManager.m.
This will build:
// RCTMapManager.m
#import <MapKit/MapKit.h>
#import "RCTViewManager.h"
@interface RCTMapManager : RCTViewManager
@end
But as soon as I add the implementation, it fails with "Linker command failed with exit code 1":
// RCTMapManager.m
#import <MapKit/MapKit.h>
#import "RCTViewManager.h"
@interface RCTMapManager : RCTViewManager
@end
@implementation RCTMapManager
RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[MKMapView alloc] init];
}
@end
I wondering why the implementation is causing this to fail, and how to fix it?
