![](/img/trans.png)
[英]'UNLocationNotificationTrigger' is not available in Mac Catalyst
[英]UIDocumentInteractionController not available in Mac catalyst
執行以下代碼時,應用程序可能會崩潰。
代碼: self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:targetURL];
崩潰日志:由於未捕獲的異常“NSGenericException”而終止應用程序,原因:“UIDocumentInteractionController 不可用”
這個問題是否有任何解決方案或任何替代 class?
盡管文檔說了什么,但它在 Catalyst 中不可用。
您可以探索使用 AppKit 替代方案 (QLPreviewPanel),但您必須進行一些黑客操作才能使其在 Catalyst 應用程序中工作: https://stackoverflow.com/a/32814132/1601849
如果您想保留與 OSX 10.5 的兼容性,可以執行以下檢查:
if UIDevice.current.systemName == "Mac OS X" {
let version = Int (UIDevice.current.systemVersion.prefix (2)) ?? 10
if version > 10 {
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:targetURL];
} else {
//do something
}
} else {
self.documentInteractionController =[UIDocumentInteractionController interactionControllerWithURL:targetURL];
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.