Post not yet marked as solved
Getting the following warning on submission:
ITMS-90626: Invalid Siri Support - Localized title for custom intent: '---' not found for locale: ...
We get a similar warning for Localized description: : Invalid Siri Support - Localized description for custom intent: '---' not found for locale: ...
Binary is accepted but would like to stop the warning.
This is an intent used for the dynamic configuration of widgets. It is its own Siri extension target which contains the intent definition file. The intent definition is localized correctly (the intent presents one user facing string on the back of the widget that appears correctly in different locales).
In the widget case, the title and description are never visible to the user. That's more for other uses of intents, like Shortcuts.
"Account" is the user-facing string and it localizes correctly. I assume the title and description strings the warning mentions are the ones listed in the intent definition file (which are also localized).
Thanks for any help!
Post not yet marked as solved
Hello, is there a way to create an iOS library (potentially a Cocoa Pod or a Swift Package) with a SiriKit custom intent to be used as a way to enhance any application with that library installed?
Post not yet marked as solved
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?
Post not yet marked as solved
I just noticed that siri custom intents are not resolving correctly for DURATION type parameters. Siri keeps providing the default value even after the user speaks. This happens on the new IOS 15 devices.
See my code snippet
guard let duration = intent.parkingTime else{
completion(INTimeIntervalResolutionResult.needsValue())
return
}
/* Siri keeps returning 0 even if the user says 100 */
if(intent.parkingTime?.doubleValue == 0){
completion(INTimeIntervalResolutionResult.needsValue())
return
}
print("PARKING TIME \(duration.doubleValue)")
completion(INTimeIntervalResolutionResult.success(with: TimeInterval(duration.doubleValue)))
}
Post not yet marked as solved
I want to use Siri to perform a repetitive task in my app that inputs variable parameters, thus accelerating the input of that data.
I have implemented a couple custom intents for background execution with the use of an intentDefinition file and implemented an IntentsExtension and associated plist to enable those custom intents. I can successfully donate an interaction that iOS matches with the supported suggestions in the intentsDefinition file that causes a Siri Suggestion to be displayed in Siri Search (or on the lock screen when enabled):
CreatePartsListIntent* createPartsListIntent = [[CreatePartsListIntent alloc] init];
createPartsListIntent.projectName = intentData.projectName;
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 can then tap on this suggestion and it takes me to my appDelegate to process the interaction within the app
- (id)application:(UIApplication *)application handlerForIntent:(INIntent *)intent {
// This method is called when I tap on the Siri suggestion
}
But I want to process the interaction in the background using voice commands. When I speak the the command of the interaction I donated, the IntentHandler is never called. I cannot figure out what I need to do to get the IntentHandler to be called. According to the WWDC18 Intro to Siri Shortcuts, I should be able to invoke a dialog with Siri, which is my goal.
Am I off track. Why isn't the IntentHandler being called? What should trigger it to be called?
Post not yet marked as solved
2021-10-15 12:26:06.427879+0800 CodeNotificationExtension[17524:630750] [default] LaunchServices: store (null) or url (null) was nil: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2021-10-15 12:26:06.428337+0800 CodeNotificationExtension[17524:630750] [default] Attempt to map database failed: permission was denied. This attempt will not be retried.
2021-10-15 12:26:06.428386+0800 CodeNotificationExtension[17524:630750] [db] Failed to initialize client context with error Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
2021-10-15 12:26:06.428445+0800 CodeNotificationExtension[17524:630750] [Intents] +[INAppInfo appInfoWithAppProxy:] Unable to create app info with application record: Error Domain=NSOSStatusErrorDomain Code=-54 "process may not map database" UserInfo={NSDebugDescription=process may not map database, _LSLine=264, _LSFunction=-[_LSDReadClient getServerStoreWithCompletionHandler:]}
Post not yet marked as solved
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?
Post not yet marked as solved
I’ve faced the following issue, and shortly the notification picture does not show up with iOS 15 under some conditions.
It seems that during INImage processing for INSendMessageIntent, it tries to generate an internal URL with intents-remote-image-proxy if the given source is not a remote URL. But proper URL doesn’t seem to be generated in some cases and the expected image doesn’t show up.
Here the weirdest part for me is that the problem only happens when I release my app (for example to the TestFlight), and with the XCode debug build my implementation works perfectly.
[This is the error trace when I release the app]
default 16:29:26.149259+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': sender image _uri: (null)
default 16:29:26.149777+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': url created from image's _identifier
default 16:29:26.149823+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': contentURL scheme does not match scheme 'intents-remote-image-proxy'. Attempting to get a corresponding url with 'intents-remote-image-proxy' scheme. contentURL: 'B4BBA163-2F98-AFCC-8A8D-1178AC8399B5'
default 16:29:26.149869+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': Getting proxied image synchronously for content url 'B4BBA163-2F98-AFCC-8A8D-1178AC8399B5'.
*** error 16:29:26.150077+0900 NotificationExt -[INImageServiceConnection synchronousServiceProxyWithErrorHandler:]_block_invoke Error (from connection <private>; pid: 0) when using image service: Error Domain=NSCocoaErrorDomain Code=4099 UserInfo={NSDebugDescription=<private>}
*** error 16:29:26.150238+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': Error getting proxied image synchronously for content url 'B4BBA163-2F98-AFCC-8A8D-1178AC8399B5' error: Couldn’t communicate with a helper application.
default 16:29:26.150280+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': Final contentURL 'B4BBA163-2F98-AFCC-8A8D-1178AC8399B5' to persist. Finished in: 0.000854 seconds
With XCode debug build, it works perfectly with generating the proper URL with 'intents-remote-image-proxy' scheme.
[This is the trace of the successful case with XCode debug build]
default 18:37:38.366065+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': sender image _uri: (null)
default 18:37:38.366822+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': url created from image's _identifier
default 18:37:38.366879+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': contentURL scheme does not match scheme 'intents-remote-image-proxy'. Attempting to get a corresponding url with 'intents-remote-image-proxy' scheme. contentURL: 'F9EFABF4-3A8F-174A-65E3-BD5B2EBEB2AF'
default 18:37:38.366920+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': Getting proxied image synchronously for content url 'F9EFABF4-3A8F-174A-65E3-BD5B2EBEB2AF'.
default 18:37:38.367166+0900 NotificationExt Persisting INImage for Intent Type 'INSendMessageIntent': Final contentURL 'intents-remote-image-proxy:?proxyIdentifier=F9EFABF4-3A8F-174A-65E3-BD5B2EBEB2AF.png&storageServiceIdentifier=com.apple.Intents.INImageServiceConnection' to persist. Finished in: 0.000929 seconds
Here is the part of my code snippet.
let friendImg = INImage(imageData: img.jpegData(compressionQuality: 0.1)!)
let senderPerson = INPerson(
personHandle: INPersonHandle(value: nil, type: .unknown),
nameComponents: nil,
displayName: “test”,
image: friendImg,
contactIdentifier: nil,
customIdentifier: nil,
isMe: false,
suggestionType: .none
)
let intent = INSendMessageIntent(
recipients: nil,
outgoingMessageType: .outgoingMessageText,
content: nil,
speakableGroupName: INSpeakableString(spokenPhrase: “test”),
conversationIdentifier: nil,
serviceName: nil,
sender: senderPerson,
attachments: nil
)
intent.setImage(friendImg, forParameterNamed: \.sender)
let interaction = INInteraction(intent: intent, response: nil)
interaction.direction = .incoming
interaction.donate(completion: nil)
do {
content = try content.updating(from: intent) as! UNMutableNotificationContent
} catch {
//…
}
}
Plus,
I’ve added NSExtension → NSExtensionAttributes (dictionary) → IntentsSupported (array) → INSendMessageIntent (string) in Notification Service Extension's Info.plist
I’ve Enabled the Communication Notifications capability on my main app target
Any Idea on this issue? Is there anything suspected?
Post not yet marked as solved
There is a common pattern used by Apple applications to get the properties of a custom type. "Get Details of Calendar Events" or "Get Details of Contacts" are examples of what I'm talking about.
It seems like these actions return different response types depending on the property that gets selected as the "detail" to get. I can't figure out how to do this in the Intent definition in Xcode.
Is this is a limitation of the current Intent definition file or is there some trick to implementing this pattern?
Post not yet marked as solved
Hi,
I haven't been able to add some basic SiriKit actions to my macOS app in macOS Monterey. To test this out, I created a new project, made it a macOS app with Storyboard. Then I added an intents definition file, and added a basic intent, with no inputs/outputs. I added the intent name to "Supported Intents" in the target "General" configuration.
Now when I build and run the app, the shortcut doesn't show up in the Apple Shortcuts app. I've tried looking for the "Siri" capability in "Signing & Capabilities" and it's not listed there (compared to a new iOS app where it would be).
I'm not sure what I'm missing here. Would love some help.
I'm using Xcode 13.1 on macOS Monterey RC.
Post not yet marked as solved
I have downloaded wwdc20-10073 Recipe Assistant project to play with it because I need to solve with Siri a similar business problem but the program doesn't work. I ran it with the default scheme Siri Intent Query (show directions for recepe on Recepe Assistant). I get an error from Siri "I can't get directions using Recipe Assistant. Sorry about that."
Can you please help what I am doing wrong.
I run the project in Xcode 13 and macOS Monterey 12.0.1
Post marked as Apple Recommended
Currently, Apple documentation states that INSearchCallHistory intent is one of the required intents needed for CarPlay to be supported for the app.
Sources for that are:
This WWDC video ~13:27 timestamp https://developer.apple.com/videos/play/wwdc2017/719
The CarPlay App Programming Guide, page 6 at the top https://developer.apple.com/carplay/documentation/CarPlay-App-Programming-Guide.pdf
However, the INSearchCallHistoryIntent is currently deprecated with a notice that it's going to be removed: https://developer.apple.com/documentation/sirikit/insearchcallhistoryintenthandling
I don't particularly want to do work that's just going to have to be removed later on. Is this still a requirement for CarPlay? Is there an updated list of required intents needed to support CarPlay?
Post not yet marked as solved
Issue Summary
Hi all,
I'm working on an Intents Extension for my app, however when I try to run an intent, Xcode pops up the following error:
Could not attach to pid: "965"
attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.)
An image of the error:
This only happens when I try debugging the Intent Extension. Running the main app target or another extension target (e.g. notifications) doesn't produce this error.
Build Setup
Here are the details of my build setup:
Mac Mini M1
Xcode 13
Building to iPhone 11 Pro Max, iOS 15.0.2. I've also tried building to my iPad Pro 12.9 w/ iOS 15.1 and hit the same issue.
Things I've tried:
Make sure "Debug executable" is unchecked in the scheme
I've tried changing the Launch setting to "Automatic" and "Wait for the executable to be launched"
I've made sure to run sudo DevToolsSecurity -enable on my mac
Rebooted iPhone devices + mac mini
Uninstalled / reinstalled the app
Deleted derived data
Removing / reinstalling the development certs in my keychain --> this actually seemed to work initially, but then the problem came back and now it doesn't work anymore.
Console Logs
I've looked at the console logs while this error occurs to see if it can shed light on the issue. Here are the ones that seemed notable to me.
These logs seem to show that Siri is trying to save / write to a file that it does not have access too. Seems very suspicious
error 11:42:38.341470-0800 kernel System Policy: assistantd(31) deny(1) file-read-metadata /private/var/mobile/Library/com.apple.siri.inference
error 11:42:38.342204-0800 assistantd failed to save contact runtime data. error=Error Domain=NSCocoaErrorDomain Code=512 "The file “com.apple.siri.inference” couldn’t be saved in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/com.apple.siri.inference, NSUnderlyingError=0x100fb03a0 {Error Domain=NSPOSIXErrorDomain Code=5 "Input/output error"}}
error 11:42:38.342403-0800 assistantd InferenceError<errorId=crSaveToRunTimeDBFailed file=/Library/Caches/com.apple.xbs/Sources/SiriInference/SiriInference-3100.49.3.1.2/SiriInference/SiriInference/ContactResolver/ContactResolver.swift function=logRunTimeData(runTimeData:config:) line=378 msg=>
error 11:42:38.465702-0800 kernel 1 duplicate report for System Policy: assistantd(31) deny(1) file-read-metadata /private/var/mobile/Library/com.apple.siri.inference
Looking for "debugserver" entries, like the error suggests, shows these logs:
default 11:42:44.814362-0800 debugserver error: [LaunchAttach] MachTask::TaskPortForProcessID task_for_pid(965) failed: ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure)
default 11:42:44.814476-0800 debugserver 10 +0.011525 sec [03c6/0103]: error: ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) err = ::task_for_pid ( target_tport = 0x0203, pid = 965, &task ) => err = 0x00000005 ((os/kern) failure) (0x00000005)
default 11:42:44.825704-0800 debugserver error: MachTask::StartExceptionThread (): task invalid, exception thread start failed.
default 11:42:44.825918-0800 debugserver error: [LaunchAttach] END (966) MachProcess::AttachForDebug failed to start exception thread attaching to pid 965: unable to start the exception thread
default 11:42:44.826025-0800 debugserver error: Attach failed
default 11:42:44.828923-0800 debugserver error: Attach failed: "Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.".
I've also attached the full details of the error below via a text file if it helps.
Any help with this issue would be great, and I'm happy to provide more information if needed. Thanks in advance!
Xcode Attach Full Error Details
Post not yet marked as solved
I have a SiriKit extension in my iOS app that uses the INSearchForAccountsIntent to display account balances via the Siri interface.When the user clicks one of the accounts in the list, Siri will automatically show the account detail screen.Can we block user from going into the detail screen by code?
The IntentHandler in my objective-C implementation of a custom intent fails to receive a call from a voice activated shortcut. When using Siri to invoke the donated interaction, I have observed that I receive the following errors in the Console app that claim the intent handler method for intent is unimplemented:
-[INIntentDeliverer _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:] _invokeIntentHandlerMethodForIntent sirikit.intent.voice_commands.RunVoiceCommandIntent
-[WFRVCIntentHandler stateMachineForIntent:] Created state machine <WFRVCStateMachine: 0x102e23970 state=WaitingForServer phase=Unknown> for intent with identifier 8A87FC68-329D-49FF-B534-B0A5821854CA
-[INIntentDeliverer _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:] _invokeIntentHandlerMethodForIntent sirikit.intent.voice_commands.RunVoiceCommandIntent
This error is consistent with the fact that an attempt to trigger the custom intent with a voice command results in iOS calling my appDelegate, and in particular the application:continueUserActivity:restorationHandler:. According to the documentation, the restorationHandler should only be called if the intent is not handled and must be handled by the main app.
As there is very little documentation for an objective-C implementation, I cannot figure out what I am missing. I have tried to map the sample SoupChef app implementation of Siri Shortcuts to my implementation. I cannot figure out where I am going wrong. Here is my implementation (sorry for all the details, but I am hoping you can see something wrong):
First, I have implemented two additional targets; a Shared Framework and an Intents Extension. I have also implemented an Intents Definition File.
Here is an image of my targets:
W_P_r is the main app, W_P_rKit is the shared framework, and PartsListManagerIntents is the Intents Extension.
Next, here is my Intents Definition file and the target membership that it belongs to:
I have also added an app group to the capabilities section of the add for both the main target and the PartsListIntentManager target. And I added Siri capability to the main target.
All of this auto-creates some code, including a default IntentHandler.m and an info.plist in the PartsListManagerIntents target. I have updated the info.plist as follows:
And here is the Auto-generated IntentHandler (which I have modified to log activity and to call a specific intent handler that resides in the W_P_rKit shared framework:
#import "IntentHandler.h"
#import <Intents/Intents.h>
#import <W_P_rKit/W_P_rKit.h>
#import "CreatePartsListIntentHandler.h"
#import "P__tHandler.h"
#import <os/log.h>
@interface IntentHandler () /* <CreatePartsListIntentHandling, P__tHandling> */
@end
@implementation IntentHandler
- (id)handlerForIntent:(INIntent *)intent {
os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_DEBUG, "handlerForIntent: Reached IntentHandler.");
if ([intent.identifier isEqualToString:@"P__rIntent"]) {
NSLog(@"P__rIntent");
return [[P__rIntentHandler alloc] init];
}
else if ([intent.identifier isEqualToString:@"CreatePartsListIntent"]) {
NSLog(@"CreatePartsListIntent");
os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_DEBUG, "handlerForIntent: IntentHandler Received CreatePartsListIntent.");
return [[CreatePartsListIntentHandler alloc] init];
}
return self;
}
Note that CreatePartsListIntentHandler is a class that implements the CreatePartsListIntentHandling protocol (resolve, confirm, and handle methods of the IntentHandler).
Now here is the relevant implementation that should trigger iOS to call the IntentHandler:
In my app at the point where the user fills in the name of a new project I make a call to donate the interaction as follows:
CreatePartsListIntent *data = [[CreatePartsListIntent alloc] init];
data.projectName = [projectPlistName copy];
data.quantity = [NSNumber numberWithInteger : currentProjectQuantity];
[[W_P_rDonationManager sharedInstance] donateCreatePartsListIntent : data];
The call to donateCreatePartsListIntent does the following:
data.suggestedInvocationPhrase = @"Create Parts List";
INInteraction* interaction = [[INInteraction alloc] initWithIntent:data response:nil];
[interaction donateInteractionWithCompletion:^(NSError * _Nullable error) { ... }
Once the user has created the empty parts list (forcing the above interaction donation to occur), the view controller will present an "Add Siri Shortcut" button. The tapping of the button automatically calls the following method to create a shortcut:
-(void) addCreatePartsListShortcutWasTapped {
NSUserActivity *userActivity = [[W_P_rDonationManager sharedInstance] CreatePartsListShortcut];
INShortcut *shortcut = [[INShortcut alloc] initWithUserActivity:userActivity];
INUIAddVoiceShortcutViewController *addSiri = [[INUIAddVoiceShortcutViewController alloc] initWithShortcut:shortcut];
addSiri.delegate = self;
[self presentViewController:addSiri animated:YES completion: nil];
}
The call to CreatePartsListShortcut does the following:
NSUserActivity *newActivity = [[NSUserActivity alloc] initWithActivityType: kW_P_rCreatePartsListActivityType];
newActivity.persistentIdentifier = kW_P_rCreatePartsListActivityType;
newActivity.eligibleForSearch = TRUE;
newActivity.eligibleForPrediction = TRUE;
CSSearchableItemAttributeSet *attributeSet = [[CSSearchableItemAttributeSet alloc] initWithContentType: UTTypeImage];
newActivity.title = @"Create Parts List";
attributeSet.contentDescription = @"Create a parts list for a new project";
newActivity.suggestedInvocationPhrase = @"Create Parts List";
UIImage *image = [UIImage imageNamed:@"W_P_r_Icon.jpg"];
NSData *imageData = [NSData dataWithData:UIImagePNGRepresentation(image)];
attributeSet.thumbnailData = imageData;
newActivity.contentAttributeSet = attributeSet;
return newActivity;
This does create a shortcut that is visible in the shortcuts app. Clicking on the shortcut or saying the invocation phrase will take you directly to the the app delegate's application:userActivity:restorationHandler. But it does not call the IntentHandler. I know this because I have implemented logs that would tell me if the execution thread came there.
Why is my IntentHandler not being called? Why is iOS sending the error message _invokeIntentHandlerMethodForIntent:intentHandler:parameterNamed:keyForSelectors:executionHandler:unimplementedHandler:?
I have actually been struggling with this for weeks. Any help or hints would be so helpful.
Post not yet marked as solved
I have a live music app to play live recordings from artists like the Grateful Dead and I'd like to add SiriKit support to it. When users refer to "albums" in my app, they would likely say "show", "recording", or "concert".
I've been testing INPlayMediaIntent and when I say "Play an album by the Grateful Dead in Live Music Archive", Siri returns the proper INMediaSearch with mediaType = album and artistName = Grateful Dead.
When I say "Play a show/recording by the Grateful Dead in Live Music Archive", Siri sets the mediaName = "Grateful Dead" and nothing else. concert is a bit better, but still not very useful.
Is it possible to configure synonyms for "album" so when Siri parses the speech, "show" / "concert" / "recording" will all resolve to "album"?
Post not yet marked as solved
Firstly I'm talking about the new iOS15 feature Focus, replacing Do Not Disturb.
I could only find APIs for getting it on iOS locally but I'd like a solution that's cross-platform.
It uses iCloud to sync the Focus between devices (Like iPhone and Mac), so I'm wondering if there's a way to get the user's currently set Focus at whatever is synced at their iCloud. Or even setting an intent to get Focus update events.
My app is web-based so it's unnecessary to have an iPhone app just for Focus access. Any help would be lovely!
Post not yet marked as solved
Hi, I'm fairly new to app development and I've stumbled upon an issue with an app I have created and deployed to the App Store already.
The issue: The app has a widget that uses Siri Intents with configurable parameters. It allows the user to choose an option from a list that is dynamically generated. On the App Store version the user is not allowed to choose, however in the simulator everything works fine.
What would be the issue?
Many thanks!
Cristian Lăpușan
Post not yet marked as solved
Hello
I created a simple SwiftUI app with Core Data and I want to be able to add data via the shortcuts app, I created a shortcut that takes some text as input and returns it in uppercase and when I run the shortcut in the shortcuts app, it works, however when I added an "add" function (to save data in the Core Data database) to the intent handle function, and I run it again nothing is saved in the app, here is the code:
class MakeUppercaseIntentHandler: NSObject, MakeUppercaseIntentHandling {
let persistenceController = PersistenceController()
func handle(intent: MakeUppercaseIntent, completion: @escaping (MakeUppercaseIntentResponse) -> Void) {
if let inputText = intent.text {
let uppercaseText = inputText.uppercased()
completion(MakeUppercaseIntentResponse.success(result: add(text: uppercaseText)))
} else {
completion(MakeUppercaseIntentResponse.failure(error: "The text entred is invalid"))
}
}
func resolveText(for intent: MakeUppercaseIntent, with completion: @escaping (MakeUppercaseTextResolutionResult) -> Void) {
if let text = intent.text, !text.isEmpty {
completion(MakeUppercaseTextResolutionResult.success(with: text))
} else {
completion(MakeUppercaseTextResolutionResult.unsupported(forReason: .noText))
}
}
func add(text: String) -> String{
let newItem = Item(context: persistenceController.container.viewContext)
newItem.text = text
do {
try persistenceController.container.viewContext.save()
} catch {
let nsError = error as NSError
fatalError("Unresolved error \(nsError), \(nsError.userInfo)")
}
return text
}
}
Thank You
Post not yet marked as solved
Hi there!
I've create a configurable widget with a custom intent.
I want to assign a default value for the intent's parameters, based on the user selection from the app - so when the widget is created it'll use this config initially.
For that I've created an intent handler with defaultParemeterName methods - and it seems to work well when a widget is created for the first time.
But for every widget that is created afterwards, the config remains stuck on the initial value that was returned from the methods, even if the user has changed the values in the app.
It seems like the methods still being called and return the correct values, but the new widgets won't use it for their default configuration - instead, it will use the initial values that was returned from the default methods.
Why is it happening? Is there a way to make it use the new values?