Xcode Templates: Core Data Cocoa Touch Application Template: Uses obsolete -[NSManagedObjectContext init]
| Originator: | quellish | ||
| Number: | rdar://17756555 | Date Originated: | Tue, 22 Jul 2014 00:50:45 GMT |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Version 6.0 (6A267n) |
| Classification: | Other Bug | Reproducible: | Always |
Summary: The Core Data Cocoa Touch Application template (and it's descendants, other templates reference this one) uses -[NSManagedObjectContext init] to create a new NSManagedObjectContext. This method has been marked as obsolete since iOS 5 (see the NSManagedObjectContext.h header) and forces an application to use the obsolete thread confinement concurrency behavior. The guidance from Apple since iOS 5 has been to NOT use this method for new code, but to use -[NSManagedObjectContext initWithConcurrencyType:] with NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType. Steps to Reproduce: 1. In Xcode, select New... from the File menu 2. Select Project from the submenu. 3. In the new Project wizard, select iOS Master-Detail application. 4. Hit Next 5. Give it a name and make sure "Use Core Data" is checked. 6. Save the project locally 8. When Xcode has the new project open, open "AppDelegate.m" 9. Look at the method -managedObjectContext Expected Results: -managedObjectContext method should create a new managed object context using the recommended initializer, initWithConcurrencyType: with either NSPrivateQueueConcurrencyType or NSMainQueueConcurrencyType as arguments. Actual Results: -managedObjectContext uses init to create a new context, which is obsolete and not recommended. Version: Version 6.0 (6A267n) Notes: Note that if this change is made, other parts of the template may need to be updated to use performBlock: and/or performBlockAndWait: when accessing the managed object context. Configuration: Model Name: MacBook Pro Model Identifier: MacBookPro6,2 Processor Name: Intel Core i7 Processor Speed: 2.66 GHz Number of Processors: 1 Total Number of Cores: 2 L2 Cache (per Core): 256 KB L3 Cache: 4 MB Memory: 8 GB Processor Interconnect Speed: 4.8 GT/s Boot ROM Version: MBP61.0057.B0F SMC Version (system): 1.58f17 Serial Number (system): W80162SEAGZ Hardware UUID: 13AC6D87-DD19-50A0-8A68-E150C94A095F Attachments:
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!