我在wwdc看过SiriKit并阅读了文档。
仅当您的应用实施以下某项操作时才添加SiriKit支持 服务类型:
- 音频或视频通话
- 消息付款
- 搜索照片
- 锻炼
- 预订
我仍然想知道我是否可以为其他服务做(因为我的应用程序将用于企业应用程序)。
我的服务将非常简单,仅搜索"在myapp中找到SQ212"。
可以吗?我担心sirkit不能支持其他服务的意图。
答案 0 :(得分:3)
不,你不能。这就是为什么只有当 你的应用实现了以下类型的服务之一时才会说" "。
您未能在foo
'中找到bar
。句法;每个相应的服务都有自己的语法 - 比如"在MyApp中开始锻炼"或"使用MyApp"预订前往place
。有关示例,请参阅https://developer.apple.com/sirikit/。
我希望使用SiriKit API的解决方法会导致您的应用在提交到常规应用商店时被拒绝,如果它通过了App Review或者没有&我认为它会非常脆弱#39;首先要经历它。
答案 1 :(得分:0)
我发现了this关于制作Sirikit Extensions
的文章,这些文章不是Apple在swifting.io上提供的默认文章。
这是链接:
https://swifting.io/blog/2016/07/18/20-sirikit-can-you-outsmart-provided-intents/
使用词汇
来自Apple文档:
使用INVocabulary对象,您可以使用对您的应用和应用的当前用户而言都是唯一的术语来扩充应用的固定词汇表。注册自定义术语为Siri提供了将这些术语适当地应用于相应的intent对象所需的提示。您只能注册特定类型的自定义术语,例如联系人姓名,用户锻炼名称,应用于照片的自定义标签或用户特定付款类型。
public enum INVocabularyStringType : Int {
case contactName
case contactGroupName
case photoTag
case photoAlbumName
case workoutActivityName
case carProfileName
}
<强> INMessage 强>
这里他们使用INSearchForMessagesIntent设置索引搜索以查找支持。
struct SupportMe{
static let systems = [
INPerson(personHandle: INPersonHandle(value: "MyNotes",
type: INPersonHandleType.unknown),
nameComponents: nil,
displayName: "MyNotes",
image: nil,
contactIdentifier: "MyNotes",
customIdentifier: "MyNotes")]
static let articles = [
INMessage(identifier: "MyNotesPassword",
content: "Retrieving password in MyNotes app. To retrieve
password use 'forgot password' button that is located below
sign in button. Then type email address that your account has
been assigned to and press reset password",
dateSent: Date(),
sender: SupportMe.systems[0],
recipients: [SupportMe.systems[0]])]
}
extension IntentHandler: INSearchForMessagesIntentHandling{
func handle(searchForMessages intent: INSearchForMessagesIntent,
completion: (INSearchForMessagesIntentResponse) -> Void){
let userActivity = NSUserActivity(activityType: String(INSearchForMessagesIntent.self))
let response = INSearchForMessagesIntentResponse(code: .success,
userActivity: userActivity)
response.messages = [SupportMe.articles[0]]
completion(response)
}
}