在构建到设备时尝试使用前向 class 'EKCalendarItem' 作为 'EKEvent' 的超级 class

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

我有一个使用 React Native 和 React Native Calendar Reminders 本机模块的 iOS 项目。在 Xcode 中构建模拟器时,一切正常。将其更改为 "Generic iOS Device" 时出现以下错误:

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 第 3 行是:

#import <EventKit/EventKit.h>

并且我验证了在 Target 的构建阶段它与 EventKit.framework 库链接。

Xcode 版本:8.2.1 (8C1002)

我自己解决了这个问题。我不确定如何,但 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.2.sdk/System/Library/Frameworks/EventKit.framework/Headers/EKCalendarItem.h 是一个空文件。我可能在某些时候查看 Xcode 时不小心清除了它。

我重新下载 Xcode 并解决了问题。

在模拟器上构建时它运行良好的原因是因为在那种情况下 EventKit.framework 是从 /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/EventKit.framework.

读取的二进制文件