set value for NSURLAttributeModificationDateKey fails

Originator:pzabelin
Number:rdar://23679944 Date Originated:
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:Always
 
fileUrl.setResourceValue(referenceDate, forKey: NSURLAttributeModificationDateKey) silently fails to set new date

Comments

iOS 9.3 SDK headers are not updated

We just received Xcode7.3 with iOS 9.3 SDK

It contains NSURL.h, which states that NSURLAttributeModificationDateKey is Read-write:

FOUNDATION_EXPORT NSString * const NSURLAttributeModificationDateKey NS_AVAILABLE(10_6, 4_0); // The time the resource's attributes were last modified (Read-write, value type NSDate)

Also ATTR_CMN_CHGTIME documented as read/write in iOS man pages in Xcode Documentation:

 ATTR_CMN_CHGTIME          (read/write) A timespec structure containing
                           the time that the file system object's
                           attributes were last modified.  Equivalent to
                           the st_ctimespec field of the stat structure
                           returned by stat(2).

Apple Engineering has provided the following feedback regarding this issue:

The NSURLAttributeModificationDateKey property is actually read-only and the comments in the header file have been changed to reflect this. NSURLAttributeModificationDateKey returns the value from getattrlist’s ATTR_CMN_CHGTIME attribute which is documented as “ATTR_CMN_CHGTIME cannot be set programmatically. Any attempt to set change time is ignored.”


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!