nsmanagedobject

What is the relationship between the post object, in the RestKit postObject method, and the RKMappingResult it returns?

*爱你&永不变心* 提交于 2019-12-12 17:39:55
问题 I have been looking through the documentation on RestKit, but I haven't been able to work out some of the specifics on RKMappingResult . I have code that creates an NSManagedObject , called newUser , and inserts in the mainQueueManagedObjectContext of the RestKit RKManagedObjectStore. I then use my object manager's postObject:path:parameters:success:failure: method to post the user to the server. This appears to work fine. I need to update some fields on the newUser managed object when the

iOS: update a core data DB from JSON

流过昼夜 提交于 2019-12-12 16:50:55
问题 In my app I store data from a JSON file in this way (it's a example for an identity) NSManagedObjectContext *context = [self managedObjectContext]; for (id element in array){ NSLog(@"element:%@", element); Str *str = [NSEntityDescription insertNewObjectForEntityForName:@"Str" inManagedObjectContext:context]; Id_loc *loc = [NSEntityDescription insertNewObjectForEntityForName:@"Id_loc" inManagedObjectContext:context]; loc.id_loc = @"id_1"; [str addLocObject:loc]; } The problem is that that I

Can I add an NSManagedObject to the selected parent object just using Interface Builder and Core Data?

眉间皱痕 提交于 2019-12-12 16:42:33
问题 I'm learning Core Data and at the moment just using Interface Builder and the XCode data model (following the Aaron Hillegass Cocoa book examples). I have an MVC application and core data set up and working within interface builder (no hand-written code yet). I've set up various arraycontrollers, views and buttons to add and remove objects and edit data and determine relationships between objects. However my object model is strictly hierarchical parent-child (and grandchildren) and each

Why are Core Data NSManagedObject faults fired upon deletion?

不羁岁月 提交于 2019-12-12 14:31:30
问题 I'm trying to efficiently batch delete a lot of NSManagedObject s (without using an NSBatchDeleteRequest ). I have been following the general procedure in this answer (adapted to Swift), by batching an operation which requests objects, deletes, saves and then resets the context. My fetch request sets includesPropertyValues to false . However, when this runs, at the point where each object is deleted from the context, the fault is fired. Adding logging as follows: // Fetch one object without

iOS Core Data how to properly initialize entity relationships?

試著忘記壹切 提交于 2019-12-12 10:06:51
问题 I have a one to many relationship in my core data model. I need to create a new entity and save it. The entity has a one to many relationship which generated the following code: - (void)addRelationshipEvent1:(NSSet *)values; - (void)removeRelationshipEvent1:(NSSet *)values; . NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity]; ApplicationRecord *newManagedObject =

Crash with NSManagedObject release: “objc_msgSend() selector name: _queueForDealloc”

元气小坏坏 提交于 2019-12-12 08:01:09
问题 I have been getting a strange crash reported by lots of users through HockeyApp with the following stack trace. It seems to have something to do with NSManagedObject being released in a different dispatch queue ... but I don't get any symbolication for where the problem might be. It seems like a memory management issue, but I'm using ARC so not sure how it would over-release an NSManagedObject. This is the crash report I get (the main thread shows different traces at different times): Code

How to extend core data entity classes

别等时光非礼了梦想. 提交于 2019-12-12 05:29:11
问题 I have some subclasses of NSManagedObject generated using Xcode. I wrote some validation codes ( validateForInsert: ) to those classes, but every time I update the data model and regenerate the subclasses, all those validation codes disappear. Some people suggest me to use categories to extend these classes instead of writing codes in it, but according to apple's document, overriding methods with categories is a very bad practice and can lead to undefined behaviour. I also tried to subclass

Process JSON data coming from server and add/update the objects in CoreData

孤街浪徒 提交于 2019-12-12 05:12:41
问题 I am working on app which uses coreData , I have two entities called folder and notes . So their is one to many relationship between folders-> notes. i.e 1 folder = many notes. I have used fetch results controller for folders, and it is displayed on the UITableView, when user clicks a folder, he goes to notes table, which displays notes inside the particular folder. User can add and delete folders/Notes. Everything works fine. Everything here is offline. Now I am trying to synchronise this

Type mismatch issue while adding to coredata array

隐身守侯 提交于 2019-12-12 04:59:33
问题 I have added the data in an alertview textfield to the object of coredata like so... let category = Category(context: self.context) category.alertTextFieldData = (alertController.textFields?.first?.text)! But now I wanted to add this to a CoreData Array which I am trying to do like this... self.people.append(category.alertTextFieldData!) But when I do this, it gives the error.. 'Cannot convert value of type 'String' to expected argument type 'Category'' where Category is the entity name. So

Setter for NSManagedObject creates _CDSnapshot_Provence_

吃可爱长大的小学妹 提交于 2019-12-12 04:12:51
问题 I have two NSManagedObject: DataEntered Provence There is a relation between them: DataEntered must have ONE Provence, and Provence may have one/multiple DataEntered. All is working well, but when using Instruments and Allocations, every time I set the Provence to DataEntered, a new _CDSnapshot_Provence_ appears in #Living: Provence * provence = [[self fetchedResultsController] objectAtIndexPath:indexPath]; [self.dataEntered setAddress_provence:provence]; The setter for Provence in