我有一个使用React Native和React Native Calendar Reminders本地模块的iOS项目。 当在Xcode和建设模拟器一切正常。 将其更改为“通用iOS设备”时,出现以下错误:
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的Build Phases中它与EventKit.framework库链接。
Xcode版本:8.2.1(8C1002)
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)
最满意答案
我自己解决了这个问题。 我不知道如何,但/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读取的二进制文件/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks/EventKit.framework 。
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.
更多推荐
发布评论