I successfully developed an intent extension for one of my apps in objective c. However, I encountered a serious problem when running the extension for the first time on a real device (it is running fine in the simulator).
In the extension UI, I access members of the intent response using a macro:
#define valueForKey(type, key) ((type)[interaction parameterValueForParameter:[INParameter parameterForClass:[response class] keyPath:key]])
While this works fine for standard members, e.g.
NSNumber *code = valueForKey(NSNumber *, @"code");
It dows not work for custom members, e.g. like
name = valueForKey(NSString *, @"name");
city = valueForKey(NSString *, @"city");
times = valueForKey(NSString *, @"times");
distance = valueForKey(NSString *, @"distance");
kind = valueForKey(NSString *, @"kind");
This perfectly works in the simulator but NOT on a real device. For every custom defined member in the response, I get the following error just before configureViewForParameters:ofInteraction:interactiveBehavior:context:completion: is called:
018-11-23 15:37:19.021273+0100 Siri Intent ExtensionUI[1665:892677] [default] No results found for query: {(
<_LSApplicationProxyForIdentifierQuery: 0x280141680>
)}
2018-11-23 15:37:19.022064+0100 Siri Intent ExtensionUI[1665:892677] [Intents] INSchemaWithTypeName Unable to find bundle URL for bundle identifier: "hmstahl.Zoigl-Kalender"
On access of each member (here "name") using above macro I then get:
2018-11-23 15:42:52.913121+0100 Siri Intent ExtensionUI[1679:895650] [Intents] -[INParameter _valueOfObject:forRemainingKeyPath:inFullyQualifiedKeyPath:] Illegal value for key <name> in fully qualified key path <name>. Exception: [<INIntentResponse 0x282752b50> valueForUndefinedKey:]: this class is not key value coding-compliant for the key name.
So something is strange with the bundle identifiers, but what?
"hmstahl.Zoigl-Kalender" is the bundle identifier of the container app,
"hmstahl.Zoigl-Kalender.Siri-Intent-Extension" that of the intent extension, and
"hmstahl.Zoigl-Kalender.Siri-Intent-ExtensionUI" the of the extension UI.