0

I have added an Intents.intentdefinition to my project. In it I have added a new intent called OrderItem with a few parameters and parameter combination.

When I try to import the autogenerated OrderItemIntent.h, the compiler throws a No newline at end of file compilation error.

Not sure what is the correct way to resolve this issue.

enter image description here

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Reza Shirazian
  • 2,303
  • 1
  • 22
  • 30
  • 3
    Where do the auto-generated files appear? I created a new intent definition, but I don't see any auto-generated classes anywhere. – Mike Welsh Jul 12 '18 at 13:51
  • 1
    @MikeWelsh these files are hidden from xcode, you can access them when you declare a variable of that type and "Jump to Definition" on them. – Reza Shirazian Jul 12 '18 at 19:55
  • 1
    What do I import? Does the blanket intent import cover it for ObjC? – Mike Welsh Jul 17 '18 at 18:09

2 Answers2

5

It seems like Xcode has a bug in the generated Intent class for Objective-C. However you can go to your project settings, search for Intent Class Generation Language and chose Swift. That should fix the problem so far.

agy
  • 2,804
  • 2
  • 15
  • 22
  • still can't import, is this working now in Xcode 10.2? Have they added fixes for the Objective-C projects. – Jerrin Jun 18 '19 at 10:10
4

Let me explain please.

The way to find an OrderItemIntent (XXXIntent) file

  1. Move to Intents(XXX).intentdefinition file.
  2. Select a intent from any custom intents.
  3. Move to Inspector panel from Xcode right side and go to third Identity Inspector section
  4. You can find 'Custom class' blank and there are a right arrow button which connect to Class file.
  5. Click that button

Thanks

Jungsu Kim
  • 94
  • 6
  • 4
    How do you reference file though from code so references resolve? I have tried most combinations I can think of, but the file itself is in some crazy deep directory that I assume wouldn't be correct to reference by full path. So there is presumably some proper way to reference these auto generated files from Objective-C as a header. – cyphers Aug 03 '18 at 22:26
  • @cyphers, select the `Intents.intentdefinition` file and open the File Inspector in the right hand pane. Check the box of your Intent target in the Target Membership box. – ɯɐɹʞ Mar 12 '20 at 21:39