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)
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…