Deprecate path-based NSBundle methods
| Originator: | mike.abdullah | ||
| Number: | rdar://13639122 | Date Originated: | 12-Apr-2013 10:08 AM |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | 10.6+ and iOS SDKs |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Summary: Stack Overflow has many people who try to do things like this: NSString *path = [[NSBundle mainBundle] pathForResource:@"example" ofType:@"png"]; NSURL *url = [NSURL URLWithString:path]; // load the resource from the URL In short, they don't understand/realise that +fileURLWithPath: exists, and should be used. NSURL is not in a good position to warn or correct people on this. However, if the path-based methods of NSBundle were to be deprecated, people would: A) Get an actual warning from the compiler that there's something they should do instead. Clang nicely allows us to generate deprecation warnings that note the correct replacement to use B) Switch to the URL-based methods, avoiding the need to create a URL themselves, and thus this common mistake It would make life just that little bit more helpful for new developers, and reduce noise on Stack Overflow for more advanced questions.
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!