NSURL setResourceValue:forKey:error: is in wrong place
| Originator: | robnapier | ||
| Number: | rdar://11977790 | Date Originated: | 27-Jul-2012 |
| Status: | Closed | Resolved: | Behaves Correctly |
| Product: | Product Version: | ||
| Classification: | Reproducible: |
27-Jul-2012 05:39 PM Rob Napier: Summary: NSURL setResourceValue:forKey:error: is a confusing duplication of NSFileManager setAttributes:ofItemAtPath:error:. Having this functionality on NSURL is confusing. NSURL represents the locator of a resource. It does not represent the resource itself. There is no -[NSURL contentData] for instance, or is there an -[NSURL doesExist] (nor should there be in either case). Nearly everything that you can set or read with NSURL is specific to filesystem objects and do not apply to generic URLs. NSURL setResourceValue:forKey:error: should be deprecated and its functionality moved to NSFileManager. Alternately, if there are NSURL keys that are intended to be useable on non-filesystem resources, a new NSResource or NSResourceWrapper (like NSFileWrapper) class should be created to represent this, allowing NSURL to return to being a data-only object. 03-Aug-2012 08:31 PM Rob Napier: Yes, this is still an issue in iOS 6.0 beta 3. As a specific example of the confusion in iOS 6, NSFileProtectionKey is set via NSFileManager (which makes sense), while NSURLIsExcludedFromBackupKey is set via NSURL (which does not make sense). Both should be set via NSFileManager. 03-Aug-2012 02:30 PM Apple Developer Bug Reporting Team : Engineering has requested the following information in order to further investigate this issue: Are you also experiencing this issue with iOS 6.0 beta 3 (10A5355d)? 15-Jan-2013 04:58 PM Apple Developer Bug Reporting Team : Engineering has determined that this issue behaves as intended.
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!