6

Having issue with defining a native module from the tutorial in https://facebook.github.io/react-native/docs/native-modules-ios.html.

#import "CalendarManager.h"
#import <React/RCTLog.h>

@implementation CalendarManager

RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(addEvent: (NSString *)name location: (NSString *)location)
{

}
@end

It give me the compile error in RCT_EXPORT_METHOD saying

"Expected ')'"

. and

'Type specifier missing, defaults to int' (later also appeared under RCT_EXPORT_MODULE)

LittleFunny
  • 8,155
  • 15
  • 87
  • 198

1 Answers1

1

You need to insert #import <React/RCTBridgeModule.h> in CalendarManager.h either.

Like this

#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>

NS_ASSUME_NONNULL_BEGIN

@interface CalendarManager : NSObject<RCTBridgeModule>

@end

NS_ASSUME_NONNULL_END
jinyang li
  • 11
  • 1