We have an issue with documents stored on a shared iCloud drive folder, where the document reloads too often, sometimes even intermittently reverting to a stale older data.
A very nice DTS lab during WWDC20 (with engineer Chen) could not solve the issue.
Here is a copy of the Feedback FB7772855
The file modification date should remain as last saved.
In the log you see that there can be sequences where after Writing a certain Text to disk, a bit later an older state is read from disk. This is after filecoordination relinquished to a writer (probably icloud deamon). Then, a second or so later it reads again and then has the current data again.
The file modification dates known by the NSDocument are also changed, dates get their milliseconds truncated after file coordination.
A very nice DTS lab during WWDC20 (with engineer Chen) could not solve the issue.
Question to the forum crowd
Does anybody also have this iCloud drive shared folder issue, and know a work around?
How can we distinguish older data coming in from newer data?
Here is a copy of the Feedback FB7772855
The Issue
The NSDocument may intermittently reload with older data than was last saved, when storing an NSDocument in a iCloud Drive shared folder. This happens without any other device editing concurrently.Reproduce
Create an iCloud Drive shared folder on a different AppleID
Open and Run the attached sample project, or get it at https://github.com/hannesoid/iCloudSharedFolderDocumentIssue
- The attached sample project uses a text field which reads/stores a String as an NSDocument
The attached sample project shows a list of log entries indicating what data was written and read by AppKit and when FileCoordination happens
The attached sample project shows the NSDocument.lastModifiedDate
Start typing into the the textfield and occasionally hit CMD+S (Save).
Expected
NSDocument should never read older data than what was last savedThe file modification date should remain as last saved.
Actual
Sometimes the TextField reverts to a previous stateIn the log you see that there can be sequences where after Writing a certain Text to disk, a bit later an older state is read from disk. This is after filecoordination relinquished to a writer (probably icloud deamon). Then, a second or so later it reads again and then has the current data again.
The file modification dates known by the NSDocument are also changed, dates get their milliseconds truncated after file coordination.
System
Tested on macOS 10.15.5