簡體   English   中英

在 iOS 13 上更新后,iCloud UIDocument 打開失敗

[英]iCloud UIDocument opening fails after update on iOS 13

我有一個簡單的 UIDocument 子類,具有覆蓋loadcontents功能。

在 iOS 13 上更新之前,json 文檔保存在 url“ /private/var/mobile/Library/Mobile Documents/iCloud~appbundle/Documents/EFB7FCBA96684AC0B101E3CD829E6996.json ”中

在當前的 iOS 版本 13.2.2(更新后)中,此文檔未打開:

let cloudDocument: ICloudDocument = ICloudDocument(fileURL: url)
cloudDocument.open { (openSuccess) in
    if openSuccess {
        success()
    } else {
        // in my case openSuccess is false
        failure()
    }
}

調試信息。

handleError中覆蓋handleError之后

override func handleError(_ error: Error, userInteractionPermitted: Bool) {     
    print("userInteractionPermitted - \(userInteractionPermitted)")
    print(error)
}

在控制台中:

userInteractionPermitted - true
Error Domain=NSCocoaErrorDomain Code=256 "The file “EFB7FCBA96684AC0B101E3CD829E6996” couldn’t be opened." UserInfo={NSURL=file:///private/var/mobile/Library/Mobile%20Documents/iCloud~appbundle/Documents/EFB7FCBA96684AC0B101E3CD829E6996.json}

如果我在 iCloudDocument 中使用cloudDocument.read方法,它可以很好地從文件接收數據,但open會引發錯誤。

DocumentState cloudDocument.documentState of document is closed

文件選項:

> print(FileManager.default.isWritableFile(atPath: url.path))
true
> print(FileManager.default.isReadableFile(atPath: url.path))
true

URLResourceKeys:

URLResourceKey.ubiquitousItemIsUploadingKey - true
URLResourceKey.ubiquitousItemIsUploadedKey - false
URLResourceKey.ubiquitousItemUploadingErrorKey - nil
URLResourceKey.ubiquitousItemHasUnresolvedConflictsKey - false
URLResourceKey.isUbiquitousItemKey - true
URLResourceKey.ubiquitousItemDownloadingStatusKey - "NSURLUbiquitousItemDownloadingStatusCurrent"

我找到了一個關於這個問題的鏈接,沒有回答https://forums.developer.apple.com/thread/126889

有任何想法嗎?

重新啟動iOS解決了這個問題。 我認為更新到 iOS 13 並遷移后,系統需要額外重新加載。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM