iOS10 Lösung: Überprüfen Sie alle kopierfähigen Typen, wenn einer von ihnen verfügbar ist, haben Sie ansonsten den vollen Zugriff.
P.S: Neue Telefon und nach iOS Update Fällen sind behoben.
- Swift 2.3--
static func isFullAccessGranted() -> Bool
{
if #available(iOSApplicationExtension 10.0, *)
{
if UIPasteboard.generalPasteboard().hasStrings
{
return true
}
else if UIPasteboard.generalPasteboard().hasURLs
{
return true
}
else if UIPasteboard.generalPasteboard().hasColors
{
return true
}
else if UIPasteboard.generalPasteboard().hasImages
{
return true
}
else // In case the pasteboard is blank
{
UIPasteboard.generalPasteboard().string = ""
if UIPasteboard.generalPasteboard().hasStrings
{
return true
}else
{
return false
}
}
} else {
// before iOS10
if UIPasteboard.generalPasteboard().isKindOfClass(UIPasteboard)
{
return true
}else
{
return false
}
}
}
- Swift 3.0--
static func isFullAccessGranted() -> Bool
{
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)
}
}
ich gleiche Problem haben. –