标签: sirikit

macOS是否有Siri的API?

我可以使用iOS应用程序编写带有Siri功能的macOS应用程序吗?

例如,当告诉Siri"播放Aurora声音"时,使用我的音乐应用程序播放声音,或SiriKit可以对执行的任何其他操作.

siri macos-sierra sirikit

5
推荐指数
1
解决办法
3200
查看次数

Siri - 如果联系人不在应用程序的联系人列表中,则停止呼叫启动

我正在实现一个VoIP应用程序,我需要通过Siri发起呼叫.我能够通过Siri发起呼叫.但问题是 - 每次启动应用程序时,虽然联系人不在应用程序的联系人列表中.

我不知道如何处理这个问题.我的意思是如果应用程序没有像Skype那样处理它的联系人,就不要启动应用程序.Skype回复说:

嗯,Skype没找到.

你想给谁打个电话?

Bellow是我的扩展处理程序的代码片段:

- (id)handlerForIntent:(INIntent *)intent {
    // This is the default implementation.  If you want different objects to handle different intents,
    // you can override this and return the handler you want for that particular intent.
    return self;
}

#pragma mark - INStartAudioCallIntentHandling

- (void)resolveContactsForStartAudioCall:(INStartAudioCallIntent *)intent
                          withCompletion:(void (^)(NSArray<INPersonResolutionResult *> *resolutionResults))completion{
    NSArray<INPerson *> *recipients = intent.contacts;
    NSMutableArray<INPersonResolutionResult *> *resolutionResults = [NSMutableArray array];
    if (recipients.count == 0) {
        completion(@[[INPersonResolutionResult needsValue]]);
        return;
    }else if(recipients.count==1){
        [resolutionResults addObject:[INPersonResolutionResult successWithResolvedPerson:recipients.firstObject]];
    }else …
Run Code Online (Sandbox Code Playgroud)

objective-c ios ios10 sirikit

5
推荐指数
0
解决办法
356
查看次数

如何在Siri工具包付款中将应用程序中的联系人添加到扩展程序

我正在开发基于Siri的支付系统应用程序.我实施了Siri及其工作正常.但我以静态方式添加联系人.但我的要求是,我将从我的服务器获取联系,而不是将其保存在我的扩展中.请建议我如何做到这一点.我正在分享一些代码片段.我的AppDelegate.swift

import UIKit
import Payment
import Intents

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?


    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Register names of contacts that may not be in the user's address book.
        let contactNames = Contact.sampleContacts.map { $0.formattedName }
        INVocabulary.shared().setVocabularyStrings(NSOrderedSet(array: contactNames), of: .contactName)
        // Override point for customization after application launch.
        return true
    }
Run Code Online (Sandbox Code Playgroud)

我的联系班级内付款框架

 import Intents

public struct Contact {

    private static let nameFormatter = PersonNameComponentsFormatter()

    public let nameComponents: PersonNameComponents …
Run Code Online (Sandbox Code Playgroud)

ios swift sirikit

5
推荐指数
0
解决办法
424
查看次数

SiriKit错误:此应用程序不支持捐赠意图

我在Xcode 10(iOS 12 Beta)中捐赠自定义意图时遇到问题.

我创建了一个自定义框架,它在我的主应用程序目标和我的'OrderIntent'目标之间共享.

我创建了一个.intentdefinition文件,其目标成员资格设置为我的自定义框架(下面的屏幕截图).

在此输入图像描述

我在主应用程序中嵌入了"Intents Extension"和"Intents UI Extension".

我还在添加了Intents扩展(下面的截图)时创建的两个info.plist文件中添加了'OrderIntent'到NSExtension-> NSExtensionAttributes-> IntentsSupported.

在此输入图像描述

我正在尝试捐赠这样的意图:

INPreferences.requestSiriAuthorization { (status) in

        if status != INSiriAuthorizationStatus.authorized {return}

        let orderIntent = OrderIntent()
        orderIntent.product = "Test product"
        orderIntent.quantity = 2

        let interaction = INInteraction(intent: customIntent, response: nil)

        interaction.donate { (error) in
            if error != nil {2
                if let error = error as NSError? {
                    print(error)
                }
            } else {
                print("success")
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

当用户点击应用程序中的按钮时,上面的代码会运行.

我也设置了这样的intent处理程序:

class IntentHandler: INExtension {

override func handler(for intent: INIntent) -> Any …
Run Code Online (Sandbox Code Playgroud)

ios sirikit ios12

5
推荐指数
1
解决办法
1661
查看次数

Sirikit:Touch Id 和提高安全性

尝试了解以下内容:

  1. https://developer.apple.com/videos/play/wwdc2016/225/ 提到sendPayments意图默认是IntentsRestrictedWhileLocked,但是如果我们想提高安全性以便用户需要使用Touch Id(本地身份验证)进行批准,那么这该怎么办呢?当设备锁定/解锁时都需要这样做。我假设扩展程序需要在“确认”阶段以某种方式显示本地身份验证 UI?

  2. 他们还提到可以提高安全性,但只需要确认执行此操作的机制是否只是 IntentsRestrictedWhileLocked 扩展属性?或者有没有办法指定需要touch id身份验证?

security touch-id sirikit

4
推荐指数
1
解决办法
1006
查看次数

Xcode 和苹果开发者中心也无法添加 Siri 功能

我做了很多研究,但没有得到任何帮助。我无法在 xcode 中添加“Siri”的功能,并且在我的苹果开发者帐户中也看不到任何选项,我被要求购买会员资格。无论如何,无需支付 99 美元即可在 iTunesConnect 中创建应用程序。我只是想学习一些新东西,比如 Siri 集成,但要做到这一点,我需要从开发者帐户添加应用程序中的功能,并添加一个我必须注册并支付 99 美元的应用程序。即使是为了学习目的也需要付费吗?

iphone xcode ios sirikit

4
推荐指数
1
解决办法
4052
查看次数

如何使用Siri快捷方式在我的应用中显示特定页面?

我想高级研究Shortcuts技术.所以这里有一些问题:

  • Siri快捷方式可用于任何类型的应用程序吗?因为SiriKit只在旅游,聊天等工作.
  • 现在使用快捷方式.我可以跳转到我的应用程序显示Siri的特定页面吗?

ios siri sirikit ios12

4
推荐指数
1
解决办法
2318
查看次数

Swift 3 - How to declare an NSOrderedSet to use setVocabularyStrings?

I want to use this function's prototype for adding vocabulary to SiriKit. Apple's documentation shows the following sample code:

let workoutNames = self.sortedWorkoutNames()
let vocabulary = INVocabulary.shared()
vocabulary.setVocabularyStrings(workoutNames, of: .workoutActivityName)
Run Code Online (Sandbox Code Playgroud)

According to the documentation, I need to use an NSOrderedSet type for self.sortedWorkoutNames().

How to declare it and set it with an array of Strings?

EDIT: About the context project, I'm using Intents with Siri. The goal here, is to use specific word like 'Benchpress' or …

ios nsorderedset swift sirikit

3
推荐指数
1
解决办法
7597
查看次数

SiriKit 自定义意图参数和快捷方式

我试图弄清楚如何使用 iOS12 中的自定义意图来定义和创建快捷方式。我想创建一个快捷方式,以便用户可以将任务添加到我的应用程序并为其命名(以及将来的其他参数)。例如,只需对 Siri 说“添加名称为‘拿起衣物’的任务”。

以下是我定义意图的方式: 在此输入图像描述

然后我尝试使用以下命令创建 Siri 快捷方式:

    TaskIntent *taskIntent = [[TaskIntent alloc] init];
    taskIntent.suggestedInvocationPhrase = @"TaskIt";

    INShortcut *taskShortcut = [[INShortcut alloc] initWithIntent:taskIntent];

    INUIAddVoiceShortcutViewController *addSiri = [[INUIAddVoiceShortcutViewController alloc] initWithShortcut:taskShortcut];
    addSiri.delegate = self;
    [self presentViewController:addSiri animated:YES completion: nil];
Run Code Online (Sandbox Code Playgroud)

然而,它最终在应用程序中出现异常:

无法从 Intent ( { taskName = ;identifier = EE4661C6-1826-4A14-84EC-FD684647FE2B; }) 创建快捷方式,因为它没有有效的参数组合

所以我不确定如何正确地做到这一点。捐赠快捷方式时是否必须提供任务名称?但这意味着每次都会显示相同的任务名称并将其添加到系统中,这不是我想要的。或者新的 SiriKit 的可定制性不足以处理通用输入?

objective-c ios sirikit ios12 inshortcut

3
推荐指数
1
解决办法
4213
查看次数

Siri 快捷方式响应模板不起作用

我已经启动并运行了快捷方式,并且我将自定义响应添加到了我的完成处理程序中。在这种情况下...

  completion ([TriggerSceneIntentResponse successIntentResponseWithSceneName:intent.sceneName]);
Run Code Online (Sandbox Code Playgroud)

当我让 Siri 运行我的快捷方式时,我成功了,但她只说“完成”或“确定”。我的成功模板是“您的场景名称场景已被激活”。然而,出于某种原因,Siri 从不使用这个模板。

我不确定图片帖子是否在论坛中有效,但我会在这里尝试一下。这是我的自定义意图在意图编辑器中的样子。

在此处输入图片说明

这就是 Siri 的回话……

在此处输入图片说明

同样,如您所见,她只是在说“完成”。当她应该说“您的洗衣房关闭 101 场景已激活”时。

我已经确认我上面的完成行是通过调试我的意图目标来调用的。我不确定我错过了什么?

ios siri sirikit ios12 sirishortcuts

3
推荐指数
1
解决办法
1335
查看次数