Custom intent code not being generated?

I have added an intent definition file, and added a custom intent to an existing (rather large) project. However, if I reference the custom intent, the symbol is not found.


I did the exact same procedure, but adding the intent definition to a brand new single view project, and when I refernce the custom intent there, the symbol is found.


It seems like my older pre-xcode10 project isn't generating the intent classes properly? Is there something I need to do in my older project settings to trigger this code generation? Or perhaps it isn't supported yet in this beta?



Thanks in advance!


-pj

Answered by pj4533 in 314947022

Solved my own problem! Seems like the code generation for objective C isnt quite working yet (or maybe the bridging between objc/swift, i didn't dig into it). But in my older project if I change the 'Intent Class Generation Language' from 'default' to 'Swift', all works as expect.


Newer projects were defaulting to swift, while my older project defaulted to objc.


Hope this helps someone!


-pj

Accepted Answer

Solved my own problem! Seems like the code generation for objective C isnt quite working yet (or maybe the bridging between objc/swift, i didn't dig into it). But in my older project if I change the 'Intent Class Generation Language' from 'default' to 'Swift', all works as expect.


Newer projects were defaulting to swift, while my older project defaulted to objc.


Hope this helps someone!


-pj

I have the same problem. I am unclear what you mean by: "change the 'Intent Class Generation Language' from 'default' to 'Swift'"


Were do I find that seeting?

I have the same issue. I can't see the generated class anywhere, in my shared framework.


public class WhenStuffIntentHandler:NSObject, WhenStuffIntentHandling // WhenStuffHandling doesn't resolve.


My Intentdefinition looks ok, and my shared frameword is ticked to have the intent class generated.


Any clues what I'm doing wrong.

No idea where you find that setting. Can you elaborate?

In Xcode 10 beta 3, the Objective C files are being generated for me. I had an issue getting things to work, but then I realized I forgot about the Objective C class prefix, set at the

.xcodeproj
level. You can see the files generated in the build folder for your target, under
DerivedSources/IntentDefinitionGenerated/Intents
, and the names of the classes are
[CLASS_PREFIX][INTENT_NAME]Intent
. You need to
#import "[CLASS_PREFIX][INTENT_NAME]Intent.h"
as well.

Thanks, this helped a lot. It wasn't the prefix that was causing the problem for me. It was the fact that I'd given my intent the name including the word "Intent" at the end.
The generated class then had "IntentIntent" at the end - the second instance added by Xcode.
I found it by examining the contents of my app's folder inside Derived Data e.g. ```DerivedData/<appName>/Build/Intermediates.noindex/<appName>.build/Debug-iphoneos/<appName>.build/```

For my old project there is also objc-code that is generated. I'd prefer Swift as I write all lthe new parts in swift and don't want bridging headers in my Siri-Extension...
Can you tell us where you found the setting to change the generated code to swift?

Ok... Just found the anwser myself...
Go to your build-settings and make sure it shows ALL, not just BASIC... Then search for intent class generation language

Hope it help the others searching for it 🙂

4 years later, yes it helped ! Thank you :)

Thank you!

Custom intent code not being generated?
 
 
Q