允许在键盘 iOS10 中进行完全访问检查

Allow Full Access check in keyboards iOS10(允许在键盘 iOS10 中进行完全访问检查)

本文介绍了允许在键盘 iOS10 中进行完全访问检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近 iOS 更新了 iOS 10 &对开发人员有一些更改,其中一项更改是现在我们无法检查 允许完全访问 我们以前的方式如下所示

Recently iOS has an update of iOS 10 & there are certain changes for developers one of the change is now we can't check allow full access the way we did previously is given below

-(BOOL)isOpenAccessGranted{
   return [UIPasteboard generalPasteboard];
 }

我搜索了最新的UIPasteboard 开发者指南,但找不到解决它.有没有人对此有适当的解决方案.

I searched the latest Developer Guide for UIPasteboard, but was unable to solve it. Did any one has a proper solution for this.

推荐答案

iOS11及以上很简单.

iOS11 and above is easy.

iOS10 解决方案:勾选所有可复制类型,如果其中一个可用,则您有完全访问权限,否则没有.

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

-- 斯威夫特 4.2--

-- 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)
    }
}

这篇关于允许在键盘 iOS10 中进行完全访问检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:允许在键盘 iOS10 中进行完全访问检查

基础教程推荐