【转】iOS Siri Shortcut快捷指令-- 不错不错!!
原文网址:iOS Siri Shortcut - 简书 (jianshu.com)
最近研究了一下Siri Shortcut和大家分享一下
1.在开发者账号中申请的bundel id中要记得勾选SiriKit
![](http://upload-images.jianshu.io/upload_images/2356427-d25b88db1e305053.png?imageMogr2/auto-orient/strip|imageView2/2/w/842/format/webp)
image.png
2.创建项目SiriShortcut
1>创建IntentHandler和IntentViewController
File-New-Target选中Intents Extension
![](http://upload-images.jianshu.io/upload_images/2356427-8eef3b92b21480cb.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
下边记得勾选
![](http://upload-images.jianshu.io/upload_images/2356427-f2eeb09ef1322923.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
创建完以后多出来两个文件夹
![](http://upload-images.jianshu.io/upload_images/2356427-288635757fd7a7ad.png?imageMogr2/auto-orient/strip|imageView2/2/w/530/format/webp)
image.png
2> 创建SiriKit Intent Definition File
![](http://upload-images.jianshu.io/upload_images/2356427-a3e9f7244fdaace8.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
创建一个CUSTOM INTENTS,命名为 Study
![](http://upload-images.jianshu.io/upload_images/2356427-043e3615ffc8b1ca.png?imageMogr2/auto-orient/strip|imageView2/2/w/1032/format/webp)
image.png
右边两个地方要勾选上,然后编译一下程序
![](http://upload-images.jianshu.io/upload_images/2356427-76c1b87ff49ee5fd.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
三个Info.plist文件的配置如下
![](http://upload-images.jianshu.io/upload_images/2356427-787fbef561077fdf.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
![](http://upload-images.jianshu.io/upload_images/2356427-f0556ae2b15174a5.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
![](http://upload-images.jianshu.io/upload_images/2356427-f766cdab46c175d9.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
Study中的配置注意标记的地方,上面的勾选大家可以尝试一下不勾选会有什么结果
![](http://upload-images.jianshu.io/upload_images/2356427-7e9f5153f1b2a9b2.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
下面是自定义的显示界面
![](http://upload-images.jianshu.io/upload_images/2356427-40703039cbb80736.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
往项目添加图片的时候打钩的地方不要忘记,不然图片在自定义的界面上是不显示的
![](http://upload-images.jianshu.io/upload_images/2356427-a875a78ef2315373.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
设置一下Deployment Info
![](http://upload-images.jianshu.io/upload_images/2356427-ba2e9b2ae8f09ea1.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
![](http://upload-images.jianshu.io/upload_images/2356427-6aba80c3cb1e6218.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
![](http://upload-images.jianshu.io/upload_images/2356427-4c9a4025c3f56268.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
添加 + 添加siri
![](http://upload-images.jianshu.io/upload_images/2356427-8993151a35ce779e.png?imageMogr2/auto-orient/strip|imageView2/2/w/1200/format/webp)
image.png
大家可以下载项目,把bundle Id换成自己的尝试下效果,下面是下载链接
https://github.com/elite-kai/SiriShortcut.git
作者:elite_kai
链接:https://www.jianshu.com/p/b0c19685b888
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
Stay hungry, stay foolish!