Mathias
Mathias

Reputation: 3981

My app does not find sirikit intentdefinition classes in xcode 11.4

My app has had support for a couple of siri shortcuts since it came out, haven't touched it in a long time. My project compiles and builds in 11.3.2 but doesn't in 11.4.

The errors i get is that the classes that are supposed to be generated from my intentdefinition file, and that i am referencing in my intenthandlers are no longer found.

For example, in my intentdefinition file i have a custom intent called "MyStatus".

I then have a MyStatusIntentHandler:

#import "MyStatusIntent.h"
@interface MyStatusIntentHandler<MyStatusIntentHandling> : NSObject

In 11.4, i get an "MyStatusIntent.h" file not found. In 11.3.1 and earlier it builds fine.

I am not super great at project config and structure, so i'm a bit at a loss as to where to start digging. If anyone has any pointers, and what in 11.4 that might be new and giving me problems, I'm all ears.

Upvotes: 6

Views: 4473

Answers (4)

Şafak Gezer
Şafak Gezer

Reputation: 4007

Stumbled upon this problem on XCode 12.4 while trying to add a ConfigurationIntent for an iOS 14 widget, and in my case the problem wasn't that the code generator was erroring out. Turned out it actually worked just fine, but the names of the classes it created were prefixed with an "Objective-C Class Prefix", (because of some Obj-C legacy project setting, or whatever) and the boilerplate code generated by XCode which referred to it was oblivious to that step and kept looking for a ConfigurationIntent class that was nowhere to be found. Changing INTENTS_CODEGEN_LANGUAGE didn't help with this either.

Anyway, in the end I had to delve into:

DerivedData/<ProjectName>/Build/Intermediates.noindex/<ProjectName>.build/Debug-iphoneos/<TargetName>/DerivedSources/IntentDefinitionGenerated/Intents

which is where I found my intent class file, and its actual name in the form of <ObjCPrefix>ConfigurationIntent. I replaced the references to ConfigurationIntent with this, and the errors finally disappeared.

Upvotes: 0

Alexander
Alexander

Reputation: 1288

I've had a similar problem in mixed swift+objc project.

There is a file 'Intents.intentdefinition' in my project for a separate Siri Extentsion target. Also, this file is included in the compilation of the application target (for using generated classes in adding intents with UI).

Siri Extenstion target builds successfully.

But Application build fails with error: "'AnyIntent.h' not found", though those files were generated (I've checked).

I solved this issue only by changing the build setting of the Siri Extension target

Intent Class Generation Language (INTENTS_CODEGEN_LANGUAGE)
from Automatic to Swift

Intent Class Generation Language set to Swift

All imports of the previously generated intents header files I changed to

#import <SiriIntents-Swift.h>

Upvotes: 12

Mathias
Mathias

Reputation: 3981

I have dug around, and also talked to Apple Support. Turns out, it has to do with the "legacy build system".

Once i switched to the new build system in xcode project settings, i could build the project again. I would argue that if they still support the legacy system (which they do), it should work, but oh well.

Read how to switch here: https://help.apple.com/xcode/mac/current/#/dev396bc94c7

Upvotes: 1

jobpav1984
jobpav1984

Reputation: 11

I have this problem too. After updated XCode get build failed with "error: use of unresolved identifier" for classes from *.intentdefinition file. with terminal build I had this message:

2020-03-26 17:11:21.874 xcodebuild[28391:166707]  DVTAssertions: Warning in /Library/Caches/com.apple.xbs/Sources/IDEIntentBuilder/IDEIntentBuilder-16029/IntentsBuildSystem/XCCompilerSpecificationIntents.m:46
Details:  Code generator extension identifier unexpectedly nil for <DVTDeclaredPrimitiveFileDataType:0x7f888398b950:49:'com.apple.sirikit.intentdefinition':'Intent Definition':-*-*-------**-----*--*----*----------------------*-------------->
Object:   <XCCompilerSpecificationIntents: 0x7f88838a4540>
Method:   -createCommandsforInputs:withMacroExpansionScope:
Thread:   <NSThread: 0x7f8892390940>{number = 13, name = (null)}
Please file a bug at https://feedbackassistant.apple.com with this warning message and any useful information you can provide.
** BUILD FAILED **

now I downgrade Xcode and add feedback to the https://feedbackassistant.apple.com/feedback/7640678

Upvotes: 1

Related Questions