In iOS, in the native Emoji keyboard, you can see your most recently used Emojis. I would like to know if it is possible to get the data on those Emojis (which is app-independent) from inside my app.
在iOS中,在本机表情符号键盘中,您可以看到最近使用的Emojis。我想知道是否有可能从我的应用程序内部获取那些Emojis(这是独立于应用程序)的数据。
My goal is to display the most used emoji, given a user, in my app.
我的目标是在我的应用程序中显示最常用的表情符号,给定用户。
1 个解决方案
#1
3
If you just want an Emoji selector you could use/modify libraries like SYEmojiPopover or AGEmojiKeyboard which allows you to have full control on the output without messing with the iOS internals (albeit the "recents" list will be app-specific).
如果您只想要一个表情符号选择器,您可以使用/修改SYEmojiPopover或AGEmojiKeyboard等库,这样您就可以完全控制输出而不会弄乱iOS内部(虽然“最近”列表将是特定于应用程序的)。
On iOS 9 the preferences are stored in the com.apple.EmojiPreferences
suite, which you could extract the list of most recently used emoji by:
在iOS 9上,首选项存储在com.apple.EmojiPreferences套件中,您可以通过以下方式提取最近使用的表情符号列表:
// swift 3:
let prefs = UserDefaults(suiteName: "com.apple.EmojiPreferences")!
let defaults = prefs.dictionary(forKey: "EmojiDefaultsKey")!["EmojiRecentsDefaultsKey"]! as! [String: Any]
let recents = defaults["RecentsKey"]! as! [String]
print(recents)
// swift 2:
let prefs = NSUserDefaults(suiteName: "com.apple.EmojiPreferences")!
let recents = prefs.dictionaryForKey("EmojiDefaultsKey")!["EmojiRecentsDefaultsKey"]!["RecentsKey"]! as! [String]
print(recents)
// prints e.g. ["????", "????", "????", "⌛", "????", "????????", "⛪", "????", "????"]
Note that this is UNDOCUMENTED, and I have only checked it works on iOS 9 when deployed via Xcode. There is no guarantee that the App Store reviewers will allow this usage, nor there is any guarantee that it will work in the past or future versions.
请注意,这是UNDOCUMENTED,我只检查它是否适用于通过Xcode部署的iOS 9。无法保证App Store审阅者将允许此用法,也不保证它将在过去或未来版本中有效。
#1
3
If you just want an Emoji selector you could use/modify libraries like SYEmojiPopover or AGEmojiKeyboard which allows you to have full control on the output without messing with the iOS internals (albeit the "recents" list will be app-specific).
如果您只想要一个表情符号选择器,您可以使用/修改SYEmojiPopover或AGEmojiKeyboard等库,这样您就可以完全控制输出而不会弄乱iOS内部(虽然“最近”列表将是特定于应用程序的)。
On iOS 9 the preferences are stored in the com.apple.EmojiPreferences
suite, which you could extract the list of most recently used emoji by:
在iOS 9上,首选项存储在com.apple.EmojiPreferences套件中,您可以通过以下方式提取最近使用的表情符号列表:
// swift 3:
let prefs = UserDefaults(suiteName: "com.apple.EmojiPreferences")!
let defaults = prefs.dictionary(forKey: "EmojiDefaultsKey")!["EmojiRecentsDefaultsKey"]! as! [String: Any]
let recents = defaults["RecentsKey"]! as! [String]
print(recents)
// swift 2:
let prefs = NSUserDefaults(suiteName: "com.apple.EmojiPreferences")!
let recents = prefs.dictionaryForKey("EmojiDefaultsKey")!["EmojiRecentsDefaultsKey"]!["RecentsKey"]! as! [String]
print(recents)
// prints e.g. ["????", "????", "????", "⌛", "????", "????????", "⛪", "????", "????"]
Note that this is UNDOCUMENTED, and I have only checked it works on iOS 9 when deployed via Xcode. There is no guarantee that the App Store reviewers will allow this usage, nor there is any guarantee that it will work in the past or future versions.
请注意,这是UNDOCUMENTED,我只检查它是否适用于通过Xcode部署的iOS 9。无法保证App Store审阅者将允许此用法,也不保证它将在过去或未来版本中有效。