Share intents from within an app to drive system intelligence and show the app's actions in the Shortcuts app.

Posts under Intents tag

49 Posts
Sort by:
Post not yet marked as solved
1 Replies
306 Views
Assuming I have a messaging app called "ExampleMessenger" with many users (e.g. Jack) who also have the app installed I would like to tell my iPhone, via Sirikit (or any other way) something like the following: "Send ExampleMessenger a message telling Jack that I am back in the office" Can Sirikit be used to send this message? If so, where is the message parsed into "Jack" and "I am back in the office"? In the Sirikit Intents code? Or in the app itself via a separate function?
Posted
by david_eye.
Last updated
.
Post not yet marked as solved
1 Replies
379 Views
I am attempting to donate an Interaction for a custom intent to create a Siri Shortcut. This is resulting in an execution error as follows: . . . *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<__NSCFString 0x2837703c0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key pronunciationHint.' terminating with uncaught exception of type NSException This error occurs with the invocation of the following code block: `CreatePartsListIntent* createPartsListIntent = [[CreatePartsListIntent alloc] init];          createPartsListIntent.nameOfProject = intentData.nameOfProject;     createPartsListIntent.quantity = intentData.quantity;     INInteraction* interaction = [[INInteraction alloc] initWithIntent:createPartsListIntent response:nil];     [interaction donateInteractionWithCompletion:^(NSError * _Nullable error) {         if(!error) {             NSLog(@"CreatePartsList donation success");         }else {             NSLog(@"CreatePartsList donation fail %@",error.localizedDescription);         }     }];` I did a search for pronunciationHint. I found this in my intents.intentsDefinition file. It is a hidden parameter, but can be found when you open the file as propertyList. It is at the end of the file under INTypes. Below is a screenshot of the INTypes content found at the end of the intents.intentsDefinition file. If I delete Item 2 and Item 3 and delete the DerivedData, I still get the same NSException error, so I don't know where it is finding pronunciationHint and why it even cares that it is there. I am not even sure why the pronunciationHint parameter is being created. An excerpt of my intentDefinition file is shown below where it is showing the parameter TYPE that I created called Project. The auto creation of pronunciationHint is apparently related to the creation of this Project TYPE: Any ideas on how I can get by this error?
Posted
by jeffb6688.
Last updated
.
Post marked as solved
2 Replies
509 Views
I am implementing a couple custom intents in my app. Having completed the implementation of the custom intent definitions and the intent handlers which presumably should be called on voice command based on the suggestedInovocationPhrase, I am getting stumped with just getting IOS to recognize my shortcut donation. While the shortcut donation is executed multiple times from the view that I am trying to create the shortcut for, it is never being displayed in the shortcut app or on my lock screen as having been donated. In my settings App, I have turned on (under Developer) "Display Recent Shortcuts" and "Display Donations on Lock Screen". Here is the code that is executing each time I think I am making a donation: - (NSUserActivity *) CreateMyShortcut {     NSUserActivity *newActivity = [[NSUserActivity alloc] initWithActivityType: kMyShortCutActivityType];          if (@available(iOS 12.0, *)) {         newActivity.persistentIdentifier = kMyShortCutActivityType;         newActivity.eligibleForSearch = TRUE;         newActivity.eligibleForPrediction = TRUE;                  CSSearchableItemAttributeSet *attributeSet = [[CSSearchableItemAttributeSet alloc] initWithContentType: UTTypeImage];                  newActivity.title = @"My Shortcut";         attributeSet.contentDescription = @"description";                  newActivity.suggestedInvocationPhrase = @"Create Widget";                  UIImage *image = [UIImage imageNamed:@"MyApp_Icon.jpg"];         NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];         attributeSet.thumbnailData = imageData;                  newActivity.contentAttributeSet = attributeSet;     }     return newActivity; } This is called from the view that I want to create the shortcut for with the following code:     // Donate a shortcut to allow Siri to assist with creating a parts list     NSUserActivity *activity = [[MyDonationManager sharedInstance] CreateMyShortcut];     NSLog(@"Donating Siri Shortcut");     [activity becomeCurrent]; Is there something else I need to do?
Posted
by jeffb6688.
Last updated
.
Post not yet marked as solved
0 Replies
307 Views
Howdy, I was wondering how I could disable an Intent Option from opening up? The large sized widget is able to disable the "Source" parameter if there isn't a network connection. I'm wanting to disable it if there is not data able to be displayed. I'm not watching to display an error or empty list. I did my best to search but wasn't able to find any answers.
Posted
by dariusngo.
Last updated
.
Post not yet marked as solved
2 Replies
827 Views
Have an app which has an intent definition defined in a framework. I understand that I have to add it to the project, but am seeing this warning message in Xcode when I run the app. The intents do seem to be working properly, however. iOS 14 and Xcode 12.5: objc[15464]: Class IntentSampleClassResolutionResult is implemented in both /private/var/containers/Bundle/Application/UUID/APPNAME.app/Frameworks/FRAMEWORKNAME.framework/Class (0x10917c2f8) and /private/var/containers/Bundle/Application/UUID/APPNAME.app/APPNAME (0x1028c1620). One of the two will be used. Which one is undefined. If I remove the intent definition file from my compile sources build settings, those warning messages disappear, but when I run the shortcut action, I get this warning in the console: 2021-06-12 21:07:54.234798-0700 APPNAME[15473:7317463] [Intents] -[INIntentResponse init] App proxy <<LSApplicationProxy: 0x127acaac0> com.company.appname file:///private/var/containers/Bundle/Application/UUID/APPNAME.app/ <com.company.appname :0>> doesn't contain intent SampleIntent, falling back to current bundle Any thoughts on how to suppress both of these warnings?
Posted Last updated
.
Post not yet marked as solved
0 Replies
399 Views
I have an intent whose flow looks like this when performing the action: 1. Get details from user 2. Add items to local db 3. Get return value from db -- if user is signed in 4. Send new data to API -- In these steps I can finish the intent at step 3, but in some cases I'll need to send the new data to an API so it can be propagated to other user's devices. If I simply wait until the API returns, some users may notice a delay after being signed in, eg: after signing in, the task now takes a few seconds when it used to take only a split second. Is there a way I can return the intent while continuing the background process? Or is it okay to simply call the completion handler, then continue my script in the func handle(intent:
Posted Last updated
.
Post not yet marked as solved
2 Replies
601 Views
In iOS 14.6 onwards Siri stopped showing the custom error response template message in the Confirm phase. When we are returning an error in the confirm phase Siri always says Sorry, You'll need to continue in the app and then Uh oh, there's a problem. Please try again. If we return the same error in the Handle phase is showing expected error message defined in the response template The same code is showing the expected error message in the iOS 14.3 devices. In iOS 14.3 device custom error response message displayed as Sorry something went wrong, App Name Says, Error response template message .... It looks like Apple updated the error message behavior in the iOS 14.6 devices. I believe this is the expected behavior of upcoming OS versions. Let me know if have any solution to resolve this issue! since we need to show a proper error message to the user in the confirm phase.
Posted Last updated
.
Post not yet marked as solved
1 Replies
459 Views
I've built a sample application and Intents Extension for macOS Monterey. It provides a single intent for a shortcut action that makes text uppercase. The intent is listed in the extension's supported intents. When a shortcut containing the action is run, rather than calling the intents extension, the hosting application is launched and the shortcut action never runs. I feel like I'm missing something obvious. Other notes: This same intents code works successfully on iOS. I have tested in both Swift and Objective-C The app delegate method for providing an intents handler is not called either. The hosting application does not list any supported intents (Also filed as FB9357568 in case there's a bug here.)
Posted
by fraserh.
Last updated
.
Post not yet marked as solved
1 Replies
682 Views
Hi, I have an intent in my app that does not allow background execution. When the user taps a notification, runs a shortcut, etc. I want it to open my app to perform the action. I have activated "Display Donations on Lock Screen" and when I tap the notification my app is opening, but the intent handler in AppDelegate is never called. Any ideas why? func application(_ application: UIApplication, handlerFor intent: INIntent) -> Any? {         switch intent {         case is OpenPassIntent:             return OpenPassIntentHandler()         default:             return nil         }  }
Posted
by espen.
Last updated
.