Cocoa - Core data migration failing with "Can't find model for source store" but managedObjectModel for source is present. Cocoa Dev Central: Core Data Class Overview. The Core Data framework provides a lot of new functionality to Cocoa developers, but manages to do so without creating an immense class hierarchy.
There are approximately a dozen key classes, which are divided into Model, Runtime and Query classes in this document. written / illustrated by Scott Stevenson The Managed Object Model contains a detailed description of an application's data types. The Model contains Entities, Properties and Fetch Requests. The Managed Object Context is where the magic really happens. Conventional Cocoa applications usually have a top-down tree of data objects that make up the model. You create a blueprint of this network using Core Data's model classes, which all revolve around the Managed Object Model. Key Model Classes Many of the model classes end in "Description". The Managed Object Model is a detailed outline of an application's data types. The Model is made up of Entities, which have Properties. By default, each Entity is mapped to NSManagedObject. File System vs Core Data: the image cache test.
Code for this project is on GitHub While doing a full re-write of Droplr's iOS app for the 2.0 launch, I couldn't find any good file/image caches out there had a particular feature I really wanted: extending item expiration whenever it's touched.
Efficient Scalar Attributes in Core Data « Lory’s Blob. I spent some time today on improving performance in my iOS development project, and I came up with some results that may be of interest to others working with Core Data.
Note that the hacks demonstrated below are based on Time Profiler measurements taken on my (egregiously unoptimized) app under development. The underlying “performance issue” only occurs when you’re using standard Core Data scalar accessors unusually frequently, like my app did. It is overwhelmingly likely that your application does not exhibit the same behavior; therefore, please use Instruments to verify that read accessors are actually slowing down your app before applying any of these tweaks.
Standard accessors Implementing accessors for scalar attributes in Core Data is somewhat inconvenient, as the framework only generates primitive accessors for scalars, and you’re supposed to write the normal accessors yourself, complete with correct access and change notifications. Use instance variables Results. Core Data Programming Guide: Non-Standard Persistent Attributes. Core Data supports a range of common types for values of persistent attributes, including string, date, and number.
Sometimes, however, you want an attribute's value to be a type that is not supported directly. For example, in a graphics application you might want to define a Rectangle entity that has attributes color and bounds that are an instance of NSColor and an NSRect struct respectively. This article describes the two ways in which you can use non-standard attribute types: using transformable attributes, or by using a transient property to represent the non-standard attribute backed by a supported persistent property. Introduction. File System Programming Guide: File System Basics. Technical Q&A QA1719: Technical Q&A QA1719. Technical Q&A QA1719 Q: My app has a number of files that need to be stored on the device permanently for my app to function properly offline.
However, those files do not contain user data and don't need to be backed up. How can I prevent them from being backed up? A: On iOS, apps are responsible for ensuring that only user data and not application data is backed up to iCloud and iTunes. The exact steps necessary vary between iOS version, so this QA will describe the process for each version of iOS. iOS 5.1 and later Starting in iOS 5.1, apps can use either NSURLIsExcludedFromBackupKey or kCFURLIsExcludedFromBackupKey file properties to exclude files from backups. Listing 1 Excluding a File from Backups on iOS 5.1 iOS 5.0.1 If your app must support iOS 5.0.1, you can use the following method to set the "do not back up" extended attribute. Listing 2 Setting the Extended Attribute on iOS 5.0.1 iOS 5.0. How To Save Your App Data With NSCoding and NSFileManager. If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter.
Thanks for visiting! This bug doesn't look so scary on disk! There are many different ways to save your data to disk in iOS – raw file APIs, Property List Serialization, SQLite, Core Data, and of course NSCoding. For apps with heavy data requirements, Core Data is often the best way to go. However, for apps with light data requirements, NSCoding with NSFileManager can be a nice way to go because it’s such a simple alternative. In this NSCoding tutorial, we’re going to take the “Scary Bugs” app that we’ve been working on in the How To Create A Simple iPhone App Tutorial Series and extend it so that it saves the app’s data to disk. Along the way, we’ll cover how you can use NSCoding to persist your normal app data, and use NSFileManager to store large files for efficiency. If you don’t have the project already, grab a copy of the Scary Bugs project where we left off last time. CoreData. Archives and Serializations Programming Guide: Introduction.
Cocoa - How do I serialize a simple object in iPhone sdk.