Search code examples
iosxcodereact-nativeeventkit

Attempting to use the forward class 'EKCalendarItem' as superclass of 'EKEvent' when building to device


I have an iOS project that uses React Native and the React Native Calendar Reminders native module. When in Xcode and building to the simulator everything works fine. When changing it to build to "Generic iOS Device" I get the following error:

While building module 'EventKit' imported from .../RNCalendarReminders.m:3:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EventKit.h:20:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EKEvent.h:37:22: error: attempting to use the forward class 'EKCalendarItem' as superclass of 'EKEvent'
@interface EKEvent : EKCalendarItem {
~~~~~~~~~~~~~~~~~~   ^

RNCalendarReminders.m line 3 is:

#import <EventKit/EventKit.h>

And I verified that in the Target's Build Phases it links with EventKit.framework library.

Xcode version: 8.2.1 (8C1002)


Solution

  • I resolved this issue myself. I'm not sure how but /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EKCalendarItem.h was an empty file. I may have accidentally cleared it out when looking at in Xcode at some point.

    I re-downloaded Xcode and it resolved the issue.

    The reason this worked fine when building on the simulator is because in that case EventKit.framework is a binary read from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/EventKit.framework.