Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
カスタムキーボードが使用したアプリを検出し、別のボタンを表示するにはどうすればよいですか? たとえば、Twitter では、入力フィールドに投稿する文字列に @ を追加し、Reddit では /r/ に投稿します。
以下のコードで可能です。カスタムキーボードを使用しているアプリのバンドル識別子を取得します。
迅速
let hostBundleID = self.parentViewController!.valueForKey("_hostBundleID") let currentHostBundleID = String(hostBundleID) print(currentHostBundleID);
バンドル識別子から、アプリ名を簡単に見つけることができます。