core-data

Core Data Saving Attributes Of Entities

南笙酒味 提交于 2020-01-05 15:07:13
问题 This question is about Core Data. I created a Entity called TV with three attributes called name , price and size . I also created a subclass of NSMutableObject with TV.h and TV.m files. I imported the TV.h to my DetailViewController.h which handles my sliders und UIElements I want to take the values of. So I did a fetch request, and everything works fine, BUT : Everytime I update the UISlider (valueDidChange:), Xcode creates a COPY of my entity and adds it to my TV-Object . All I want Xcode

Move rows to bottom in a TableView which uses CoreData

折月煮酒 提交于 2020-01-05 13:08:29
问题 In my app I have a folder-file (one-to-many relationship).So when I open my app, my firstViewController contains all files and when clicked on each folder, it opens a tableViewController displaying files in that folder. Now here whenever I swipe any row, it is moved to bottom row and the table is update accordingly, the next swiped row will go and sit above the first swiped row. Eg, at present if my table contains 0 1 2 3 A B C D After swiping A 0 1 2 3 B C D **A** after swiping B 0 1 2 3 C D

What would be a good way to design this core data database?

强颜欢笑 提交于 2020-01-05 12:06:32
问题 I am working on an iphone app that uses core data. The data includes large list of people. Each person will have certain attribues which are the same. First Name, Last Name, age and few more. Then these people will be divided into categories. The problem that i am having people who are in different categories will have different attributes. For example Person A will be in category A and will have attributes a,b,c Person B will be in category B and will have attribues b,c,d Person C will be in

Full Example Of Implementing Notifications For Core Data NSManagedObject

你离开我真会死。 提交于 2020-01-05 10:29:52
问题 Could somebody point me in the correct direction for a full implementation example of NSManagedObjectContextObjectsDidChangeNotification NSManagedObjectContextDidSaveNotification and NSManagedObjectContextWillSaveNotification I have read the references to it here: http://developer.apple.com/library/ios/#documentation/cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectContext_Class/NSManagedObjectContext.html but I don't see a full example code of exactly where I should implement it so

Full Example Of Implementing Notifications For Core Data NSManagedObject

巧了我就是萌 提交于 2020-01-05 10:28:09
问题 Could somebody point me in the correct direction for a full implementation example of NSManagedObjectContextObjectsDidChangeNotification NSManagedObjectContextDidSaveNotification and NSManagedObjectContextWillSaveNotification I have read the references to it here: http://developer.apple.com/library/ios/#documentation/cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectContext_Class/NSManagedObjectContext.html but I don't see a full example code of exactly where I should implement it so

Observing changes in the properties of an NSManagedObject: how to avoid looping?

微笑、不失礼 提交于 2020-01-05 10:14:49
问题 In my application, I observe the properties of a managed object. A change may lead to adjustments in some of its other properties, so the managed object itself receives a message of a changed property. These changes happen through bindings that are set up in the Interface Builder. I have the following method in the implementation of the managed object: -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (

Observing changes in the properties of an NSManagedObject: how to avoid looping?

夙愿已清 提交于 2020-01-05 10:14:07
问题 In my application, I observe the properties of a managed object. A change may lead to adjustments in some of its other properties, so the managed object itself receives a message of a changed property. These changes happen through bindings that are set up in the Interface Builder. I have the following method in the implementation of the managed object: -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (

CoreData getting attribute type - how to determine if it is a primitive

醉酒当歌 提交于 2020-01-05 09:36:19
问题 I'm trying to get all the attributes for an entity and then determine their type - I know I can do something on this line: if(![[thisAttribute attributeValueClassName] isKindOfClass:[NSString class]]) { but how do I check for a BOOL, Float or Integer? Here's my code so far: //get the attributes for this entity - we need to parse the dictionary of data we want to store and convert its contents from NSStrings to whatever type the entity requires NSEntityDescription* entity =

Saving Core Data Context before Crashing

天涯浪子 提交于 2020-01-05 08:19:30
问题 For example if we hit "Stop" in XCode, it will close the app, mimicking the crash behaviour. But if my Core Data Context hasn't been saved, when I go back, the data won't be there. Are there any workaround for this? Should I save the context every time a big operation is finished? Thanks. 回答1: Based on my experience you should decide the right granularity when you use Core Data save mechanism. IMHO (maybe someone else could have different opinions) there is no standard to follow. My rule of

Coredata number returns a number of PFCachedNumber class

自闭症网瘾萝莉.ら 提交于 2020-01-05 07:35:09
问题 Like the title says i have a one to many relationship and the many accepts numbers, and it is given an NSNumber, however when i retrieve that number back from coredata it comes in the form of a PFCachedNumber. Any thoughts on why this may be? Thanks! for (UserNumber *info in pinNumberArray) { //The numbers I'm after are inside ergTimes. NSSet *time = [[NSSet alloc] initWithSet:info.Times]; for (ErgTimes *ergTimes in time){ NSLog(@"Times Class : %@", [ergTimes.Twok class]); } } 回答1: I wouldn't