基本就是这样,我还没有找到一种方法来禁用我的应用程序中的第三方键盘,虽然我知道这可能是因为我在1Password等应用程序中看到它。
有什么想法吗?
答案 0 :(得分:13)
在AppDelegate
func application(application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: String) -> Bool {
if extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier {
return false
}
return true
}
Swift 4:
func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
if extensionPointIdentifier == UIApplicationExtensionPointIdentifier.keyboard {
return false
}
return true
}
答案 1 :(得分:9)
斯威夫特3:
func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplicationExtensionPointIdentifier) -> Bool {
if extensionPointIdentifier == UIApplicationExtensionPointIdentifier.keyboard {
return false
}
return true
}
答案 2 :(得分:3)
Swift 4.2
func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplication.ExtensionPointIdentifier) -> Bool {
if extensionPointIdentifier == UIApplication.ExtensionPointIdentifier.keyboard {
return false
}
return true
}
答案 3 :(得分:1)
在 Swift 5.0
中 func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplication.ExtensionPointIdentifier) -> Bool {
return extensionPointIdentifier == UIApplication.ExtensionPointIdentifier.keyboard ? false : true
}
答案 4 :(得分:0)
func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplication.ExtensionPointIdentifier) -> Bool {
return extensionPointIdentifier != .keyboard
}