iOSアプリでSiriKitを実装しようとしています。アプリを起動したときに別のView Controllerを開きたい〜シリアプリがSiriKit経由で起動されたときに別のUIViewControllerを開きます
アプリケーションでこのタイプの操作を処理するにはどうすればよいですか?
iOSアプリでSiriKitを実装しようとしています。アプリを起動したときに別のView Controllerを開きたい〜シリアプリがSiriKit経由で起動されたときに別のUIViewControllerを開きます
アプリケーションでこのタイプの操作を処理するにはどうすればよいですか?
これは可能ですが、まずあなたのアプリにSiriKitをセットアップする必要があります。これは、長い命令リストを持つ作業です:https://developer.apple.com/library/prerelease/content/documentation/Intents/Conceptual/SiriIntegrationGuide/index.html#//apple_ref/doc/uid/TP40016875-CH11-SW1。
サンプルシリキットアプリケーションは、AppleがUnicornChat呼ば一緒に入れていることもあります:https://developer.apple.com/library/content/samplecode/UnicornChat/Introduction/Intro.html
あなたのシリキットアプリケーションの拡張を追加して、適切にあなたの意思を扱ってきたら、あなたが使用してアプリに送信することができるようになりますインテントに関連付けられたResponseCode。このアプリを開き、あなたがそれをキャッチし、あなたのアプリケーションのデリゲートに次のコードを追加してWhateverViewControllerにそれを送ることができます。
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
// implement to handle user activity created by Siri or by our SiriExtension
let storyboard = UIStoryboard(name: "Main", bundle: nil)
// Access the storyboard and fetch an instance of the view controller
let viewController: WhateverViewController = storyboard.instantiateViewController(withIdentifier: "WhateverViewController") as! WhateverViewController
window?.rootViewController = viewController
window?.makeKeyAndVisible()
}
こんにちはヴィヴェックを、StackOverflowのために歓迎!この質問は現在、StackOverflowコミュニティにとっては広すぎます。この問題に関してどのような調査をしたか、解決策を試したことを示し、さらに具体的な質問をしてみてください。 SiriKitとAppDelegate/UIViewControllerに関するAppleのドキュメントもお読みください。 –