I'm attempting to implement some new Siri integrations into my app. I have an old Objective-C header that I've been using on my project as a whole, but now this new Siri Intents target also needs a header. So now I have two objective-c bridging headers, one for the main project and its target, and another for the Siri Intents target.
我正在尝试在我的应用程序中实现一些新的Siri集成。我有一个旧的Objective-C标题,我一直在我的项目中使用,但现在这个新的Siri Intents目标也需要一个标题。所以现在我有两个objective-c桥接头,一个用于主项目及其目标,另一个用于Siri Intents目标。
It's not working like I expected it to. I'm getting the "unresolved use of identifier" error referring to one of the objective-C classes I'm trying to import.
它没有像我预期的那样工作。我正在获取“未解析的标识符使用”错误,指的是我正在尝试导入的一个Objective-C类。
In my build settings for the following:
在我的以下构建设置中:
- Project: directory for main bridging header
- 项目:主桥接头的目录
- Targets:
- selfTitledTarget: directory for main bridging header
- selfTitledTarget:主桥接头的目录
- SiriIntent: directory for new bridging header
- SiriIntent:新桥接头的目录
- 目标:selfTitledTarget:主桥接头的目录SiriIntent:新桥接头的目录
My main bridging header includes all the imports of the new bridging header just to be safe.
我的主要桥接头包括所有新桥接头的导入,只是为了安全。
I didn't have this problem prior to starting the new Siri implementations. I have another project that is ONLY the Siri implementations and that one works fine, so I'm guessing that my problem is rooted in the fact that I have multiple bridging headers?
在开始新的Siri实现之前,我没有遇到这个问题。我有另一个项目,只有Siri实现,并且一个工作正常,所以我猜我的问题根源于我有多个桥接头?
2 个解决方案
#1
1
Project: directory for main bridging header
项目:主桥接头的目录
Targets:
目标:
selfTitledTarget: directory for main bridging header
selfTitledTarget:主桥接头的目录
SiriIntent: directory for new bridging header
SiriIntent:新桥接头的目录
That makes no sense. Projects don't have bridging headers; targets do. And their bridging header build settings are not directories; they are files.
这是没有意义的。项目没有桥接标题;目标呢。他们的桥接头部构建设置不是目录;他们是文件。
So, step one is to make sure you have just two bridging headers, one per target.
因此,第一步是确保只有两个桥接头,每个目标一个。
After that, I would suggest importing all your Objective-C .h
files in both bridging headers. It can't hurt, and it should solve your problems.
之后,我建议在两个桥接头中导入所有Objective-C .h文件。它不会伤害,它应该解决你的问题。
#2
0
It's not the header: one bridging header per target is exactly how this should work.
这不是标题:每个目标的一个桥接标题正是这应该如何工作。
The problem is that the referenced class isn't being compiled into the intent target. Check the target membership pane in the File Inspector (⌘⌥1) and set the shared source files to be included in all targets where they're needed.
问题是引用的类没有被编译到intent目标中。检查文件检查器中的目标成员资格窗格(⌘⌥1),并将共享源文件设置为包含在需要它们的所有目标中。
#1
1
Project: directory for main bridging header
项目:主桥接头的目录
Targets:
目标:
selfTitledTarget: directory for main bridging header
selfTitledTarget:主桥接头的目录
SiriIntent: directory for new bridging header
SiriIntent:新桥接头的目录
That makes no sense. Projects don't have bridging headers; targets do. And their bridging header build settings are not directories; they are files.
这是没有意义的。项目没有桥接标题;目标呢。他们的桥接头部构建设置不是目录;他们是文件。
So, step one is to make sure you have just two bridging headers, one per target.
因此,第一步是确保只有两个桥接头,每个目标一个。
After that, I would suggest importing all your Objective-C .h
files in both bridging headers. It can't hurt, and it should solve your problems.
之后,我建议在两个桥接头中导入所有Objective-C .h文件。它不会伤害,它应该解决你的问题。
#2
0
It's not the header: one bridging header per target is exactly how this should work.
这不是标题:每个目标的一个桥接标题正是这应该如何工作。
The problem is that the referenced class isn't being compiled into the intent target. Check the target membership pane in the File Inspector (⌘⌥1) and set the shared source files to be included in all targets where they're needed.
问题是引用的类没有被编译到intent目标中。检查文件检查器中的目标成员资格窗格(⌘⌥1),并将共享源文件设置为包含在需要它们的所有目标中。