8 Replies
      Latest reply on Aug 30, 2018 4:05 AM by georgbachmann
      pj4533 Level 1 Level 1 (0 points)

        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

        • Re: Custom intent code not being generated?
          pj4533 Level 1 Level 1 (0 points)

          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

            • Re: Custom intent code not being generated?
              ruben.nieves Level 1 Level 1 (0 points)

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

              • Re: Custom intent code not being generated?
                gfiumara Level 1 Level 1 (0 points)

                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.

                  • Re: Custom intent code not being generated?
                    siburb2 Level 1 Level 1 (0 points)

                    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/```




                  • Re: Custom intent code not being generated?
                    georgbachmann Level 1 Level 1 (0 points)

                    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?

                  • Re: Custom intent code not being generated?
                    rumbles Level 1 Level 1 (0 points)

                    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?