iCloud Drive changes of restored files are not announced properly

Originator:marcin.krzyzanowski
Number:rdar://29880025 Date Originated:5 Jan 2017
Status:Open Resolved:
Product:iCloud Product Version:
Classification: Reproducible:
 
Summary:
Let's say we have iOS application with iCloud Drive enabled and NSMetadataQuery started.

Steps to Reproduce:
Once file is deleted on macOS, it's moved to the ".Trash" directory and application receive NSMetadataQueryDidUpdateNotification about the change, like this one:

NSMetadataQueryDidUpdateNotification received {
    kMDQueryUpdateAddedItems =     (
    );
    kMDQueryUpdateChangedItems =     (
        "<NSMetadataItem: 0x60000003b500> URL: file:///Users/marcinkrzyzanowski/Library/Developer/CoreSimulator/Devices/EDE8CE6B-E25B-4BEE-87E3-FA41DB025481/data/Library/Mobile%20Documents/iCloud~com~pspdfkit~viewer/Documents/.Trash/bilety_2%20copy.pdf"
    );
    kMDQueryUpdateRemovedItems =     (
    );
}


later, when file is restore from the trash (possible from the macOS only), iOS application receive notification about removed files only:

NSMetadataQueryDidUpdateNotification received {
    kMDQueryUpdateAddedItems =     (
    );
    kMDQueryUpdateChangedItems =     (
    );
    kMDQueryUpdateRemovedItems =     (
        "<NSMetadataItem: 0x60000003b500> URL: file:///Users/marcinkrzyzanowski/Library/Developer/CoreSimulator/Devices/EDE8CE6B-E25B-4BEE-87E3-FA41DB025481/data/Library/Mobile%20Documents/iCloud~com~pspdfkit~viewer/Documents/.Trash/bilety_2%20copy.pdf"
    );
}

that is only partially correct. The file is removed from the ".Trash", true, but is re-added to the original directory.

Expected Results:
I expect here either change notification the same as when moving to the ".Trash", or another "kMDQueryUpdateAddedItems" notification for the files.

Actual Results:
Files are added without notification.

Version:
iOS 10, macOS 10.12.2

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!