问题描述
最近 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)
}
}
似曾相识燕归来20795590