core-data

Custom setter methods in Core-Data

时间秒杀一切 提交于 2020-01-19 06:42:38
问题 I need to write a custom setter method for a field (we'll call it foo ) in my subclass of NSManagedObject . foo is defined in the data model and Xcode has autogenerated @property and @dynamic fields in the .h and .m files respectively. If I write my setter like this: - (void)setFoo: (NSObject *)inFoo { [super setFoo: inFoo]; [self updateStuff]; } then I get a compiler warning on the call to super . Alternatively, if I do this: - (void)setFoo: (NSObject *)inFoo { [super setValue: inFoo forKey:

Starting point in learning Core Data on iPhone?

一曲冷凌霜 提交于 2020-01-19 04:05:24
问题 What is the starting point for Core Data in order to get involved quickly? Any useful link, blog or book or other resourse? 回答1: You might be interested in video of the Core Data class from my Advanced iPhone Development course, which is available for free on iTunes U. I walk through Core Data and how to use it in an iPhone application. If you log in to the iPhone Developer Program site, you have access to a series of videos for free, among which is the session "Working with Core Data" (in

Swift core data does not store data permanently

旧街凉风 提交于 2020-01-17 17:12:05
问题 I have an Entity called "Friend".. Attributes are name and age..here I have implemented bridging because NSManagedObject class for Friend has .h and .m file. My code to store data: var err: NSError? var delegate:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate var friend:Friend = Friend(entity: NSEntityDescription.entityForName("Friend", inManagedObjectContext: delegate.managedObjectContext), insertIntoManagedObjectContext: delegate.managedObjectContext) friend

CoreData database not showing in sqlite since moving to Xcode 5

别来无恙 提交于 2020-01-17 12:39:46
问题 I have an app that uses a CoreData database the contents of which I view using sqlite . The database path is the same: /Users/Comp1/Library/Application Support/iPhone Simulator/7.0.3/Applications/16226A0A-575C-4356-BFAA-6B1A009C0585/Documents and I can see the database file. But when I open it in sqlite there appears to be no data, although I can read through the app. It was working fine until I loaded Xcode 5. Does anyone know why this might be? No tables shown: 回答1: What happens when you

autosavesInPlace causes New Document save to fail

无人久伴 提交于 2020-01-17 08:43:21
问题 I have a NSPersistentDocument based app which fails to save a new document when autosavesInPlace is set to return YES , return NO and the problem disappears. I create a new document Make some changes Save it , thus running NSSaveAsOperation , the name of the document and the URL changes and all appears to be well but the next save will throw a very descriptive NSPersistentStoreSaveError = 134030, // unclassified save error - something we depend on returned an error This only happens when the

Problem with property inherited from parent entity

自古美人都是妖i 提交于 2020-01-17 05:26:07
问题 I'm trying to keep traveling route in core data and here is my data model. I have entity Coordinate keeping latitude and longitude in double, then I created Locatable entity and make relation between these two entities. Coordinate <-> Locatable then I have POI entity inherited Locatable these POI representing my route. finally I have Destination entity inherited POI using as my destination point Coordinate <-> Locatable | V POI | V Destination My Route class have points as one-to-many

Problem with property inherited from parent entity

烈酒焚心 提交于 2020-01-17 05:26:05
问题 I'm trying to keep traveling route in core data and here is my data model. I have entity Coordinate keeping latitude and longitude in double, then I created Locatable entity and make relation between these two entities. Coordinate <-> Locatable then I have POI entity inherited Locatable these POI representing my route. finally I have Destination entity inherited POI using as my destination point Coordinate <-> Locatable | V POI | V Destination My Route class have points as one-to-many

Multiple UIManagedDocument For Read & Write

别等时光非礼了梦想. 提交于 2020-01-17 05:08:21
问题 I'm building a tab bar application for iPhone and i'm using Core Data with two UIManagedDocument s. In the first tab, i write the data to database and in the second i read them into UITableView with UIFetchedResultsController . At the start of application, if i write data first, and after then i read results, it works fine. Results appear in the second tab immediately. However, if i read some data first and after then if i write something to database, results appear in second tab with

Is there no way to use IB and the relationship of two entities to populate an OutlineView?

。_饼干妹妹 提交于 2020-01-16 18:30:13
问题 I have touched on this question in others before but after writing an answer to a previous question there got me wondering why this isn't possible - or am I missing the fact that it might be? Given that Interface Builder is very good at graphically linking various methods and delegates and data sources, is it possible that there's no straightforward graphical means to populate an OutlineView using two entities made in a Core Data model that have a parent child relationship set up so that (I

Is there no way to use IB and the relationship of two entities to populate an OutlineView?

坚强是说给别人听的谎言 提交于 2020-01-16 18:30:10
问题 I have touched on this question in others before but after writing an answer to a previous question there got me wondering why this isn't possible - or am I missing the fact that it might be? Given that Interface Builder is very good at graphically linking various methods and delegates and data sources, is it possible that there's no straightforward graphical means to populate an OutlineView using two entities made in a Core Data model that have a parent child relationship set up so that (I