Intents extension crashes when trying to set property of custom INIntentResponse subclass

Originator:simon
Number:rdar://45218245 Date Originated:12 October 2018
Status:Open Resolved:
Product:iOS + Siri Product Version:iOS12 (& 12.1 beta)
Classification: Reproducible:Always
 
Summary:
When the device is set to use anything other than the base language of the ".intentdefinition" file, it is impossible to use custom intents that return a response.

Steps to Reproduce:
1. Create a custom intent that has a response that is just a single string. Use English as the base language of the .intentdefinition file.
2. Implement a simple Intents extension to handle this custom intent.
3. Localize the .intentdefinition file into another language e.g. Spanish.
4. Run the intent on a device configured to use English, the Intents Extension will be able to construct the custom INIntentResponse object correctly and Siri will return the correct response.
5. Switch this same device to Spanish and run the same custom intent - the Intents extension will crash when trying to set the custom response's properties and Siri will therefore just state that there's been "a problem".
6. Run the intent on a device configured to use a language that the app has NOT been localized into, the Intents Extension will fall back to English, and will therefore be able to construct the custom INIntentResponse object correctly and Siri will return the correct response.

Expected Results:
The Intents Extension should be able to set the properties on the custom INIntentResponse object without an exception being thrown.

Actual Results:
An exception (attached) is thrown when the Intents Extension tries to set the property on the custom INIntentResponse object.

Version/Build:
Xcode 10 (& 10.1 beta).
iOS 12 (& 12.1 beta).

Comments

Thanks a lot, this saved me tons of hours!

For me it, with 'en' as default localization, it even crashed when responding in a language that it has been localized into.

By mickeylauer at Dec. 17, 2018, 1:49 p.m. (reply...)

There's still a bug, but I've found a work around. Have ticked "Base" for the intent definition file, therefore moving the .intentdefinition file to the Base.lproj directory instead of en.lproj. Everything now seems to work correctly for languages we support, and those that we don't.

Console:

`2018-10-12 13:54:41.313421+0800 Intents Extension[1061:22075] [Intents] INSchemaWithTypeName Did not find schema inside of bundle URL: "file:///private/var/containers/Bundle/Application/3995A903-CCCC-400D-A123-70AAAA387C97/MyApp.app/PlugIns/Intents%20Extension.appex/" 2018-10-12 13:54:41.314191+0800 Intents Extension[1061:22075] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<DailyBriefingIntentResponse 0x1460568f0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key briefingDescription.' *** First throw call stack: (0x21d409ed0 0x21c5d9a40 0x21d3239ac 0x2287072d4 0x228707404 0x2286caad4 0x1028d573c 0x102870f28 0x2285eeb48 0x2285f03f0 0x21ce436c8 0x21ce44484 0x21ce1efb0 0x21ce1faf4 0x21ce27f14 0x21d0260dc 0x21d028cec) libc++abi.dylib: terminating with uncaught exception of type NSException `


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!