gpt4 book ai didi

ios - 如何知道用户是否从 iPhone 设置中删除了我的自定义键盘?

转载 作者:行者123 更新时间:2023-11-28 06:36:08 27 4
gpt4 key购买 nike

我如何知道用户是否从 iPhone 设置中删除了我的自定义键盘。

我的键盘被移除后,我必须管理一些用户默认值。

最佳答案

    static func isKeyboardInstalled() -> Bool {
var isInstalled = false

if let dict: AnyObject = NSUserDefaults.standardUserDefaults().dictionaryRepresentation() {
let userDefaultsDictionary: Dictionary<String, AnyObject> = dict as! Dictionary<String, AnyObject>
let keyboardArrayAnyObject: AnyObject? = userDefaultsDictionary["AppleKeyboards"]
if let array: AnyObject = keyboardArrayAnyObject {
let keyboardsArray: Array<String> = array as! Array<String>
let appUrlSceme: String? = SystemUtils.applicationIdentifier()

if let urlScheme = appUrlSceme {
for item in keyboardsArray {
if (item as NSString).containsString(urlScheme) {
isInstalled = true
}
}
}
}
}

return isInstalled
}

static func applicationIdentifier() -> String? {
var appIdentifier: String? = nil

if let identifier = NSBundle.mainBundle().objectForInfoDictionaryKey(kCFBundleIdentifierKey as String) as? String {
appIdentifier = identifier
}

return appIdentifier
}

关于ios - 如何知道用户是否从 iPhone 设置中删除了我的自定义键盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39061117/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com