How to check the “Allow Full Access” is enabled in iOS 8?

后端 未结 15 1250
醉酒成梦
醉酒成梦 2020-12-02 07:53

In iOS 8, when develop a custom keyboard and set RequestsOpenAccess property to YES in info.plist, there is a toggle button at Settings-> Add New Keyboard named \"Allow Full

15条回答
  •  情话喂你
    2020-12-02 08:29

    iOS11 and above is easy.

    iOS10 Solution: Check all the copy-able types, if one of them is available, you have full access otherwise not.

    -- Swift 4.2--

    override var hasFullAccess: Bool
    {
        if #available(iOS 11.0, *){
            return super.hasFullAccess// super is UIInputViewController.
        }
    
        if #available(iOSApplicationExtension 10.0, *){
            if UIPasteboard.general.hasStrings{
                return  true
            }
            else if UIPasteboard.general.hasURLs{
                return true
            }
            else if UIPasteboard.general.hasColors{
                return true
            }
            else if UIPasteboard.general.hasImages{
                return true
            }
            else  // In case the pasteboard is blank
            {
                UIPasteboard.general.string = ""
    
                if UIPasteboard.general.hasStrings{
                    return  true
                }else{
                    return  false
                }
            }
        } else{
            // before iOS10
            return UIPasteboard.general.isKind(of: UIPasteboard.self)
        }
    }
    

提交回复
热议问题