magicalrecord

NSFetchedResultsController and getting the grouping right

廉价感情. 提交于 2020-01-25 22:52:49
问题 I have the following problem. I have a UITableview that is powered by an NSFetchedResultsController. It should display let's say a projects, folders and files. There is no bigger hierarchy than that. So a project has several folders and those have several files. Now my table view should display those files, grouped by folders. So i thought my fetch requests' predicate would simply be: [NSPredicate predicateWithFormat:@"folder.project = %@", self.project]; I would then use MagicalRecord to

iOS Magical record import from array

流过昼夜 提交于 2020-01-25 20:27:18
问题 Hi I'm making a synchronise function that update database when receive JSON response from server. I want the import only take place if there are different data (new record or update existing record) (To increase performance) (Using coredata and magicalRecord ) Here is my JSON parser method - (void)updateWithApiRepresentation:(NSDictionary *)json { self.title = json[@"Name"]; self.serverIdValue = [json[@"Id"] integerValue]; self.year = json[@"Year of Release"]; self.month = json[@"Month of

Magical Record, saving, and NSFetchedResultsController

对着背影说爱祢 提交于 2020-01-22 12:27:36
问题 Not sure if this is an issue with the way Magical Record does saves, or I'm just making an noob mistake somewhere. I'm using an NSFetchedResultController (FRC) and UITableView to display a list of entities, when the user taps "Add" a new View Controller with an editor is pushed, a new entity is created with [MyEntity MR_createEntity] . The user can add additional entities here that are added to the main entity via a relationship. When the user taps "Save" in this View Controller the context

Magical Record import with already existing data

不问归期 提交于 2020-01-12 07:51:06
问题 I'm trying to use Magical Record to import data into my CoreData db. I'm working on the entity Person at the moment. A Person has firstName , lastName , personID attributes. (I know I don't need the idString, I'm not using it internally, it is used to talk back to the server). Anyway, if I already have the person... firstName - John lastName - Smith personID - 1 And I download the JSON... [ { firstName: John, lastName: Doe, id: 1 }, { firstName: Michael, lastName: Caine, id: 2 }, { firstName:

Core Data concurrency `performBlockAndWait:` NSManagedObjectContext zombie

╄→гoц情女王★ 提交于 2020-01-11 13:47:13
问题 I have a following crash report from my released app: synchronizeMyWords method fetches the entities from database, creates private queue context with main context parent and finally saves results. All operations are in the background thread. This method being called every time app goes into background and foreground . Here is a simplified method: - (AWSTask *)synchronizeMyWords { __weak typeof(self) weakSelf = self; AWSContinuationBlock block = ^id _Nullable(AWSTask * _Nonnull task) { if (

ios MagicalRecord sorting. Need a list of section headers

你离开我真会死。 提交于 2020-01-06 14:15:32
问题 I have a Core Data model accessed using MagicalRecord. I use this code to get a tableview sorted and grouped by categories: frc = [ListActivity MR_fetchAllSortedBy:@"activityCategory,activityName" ascending:YES withPredicate:nil groupBy:@"activityCategory" delegate:nil]; The resulting tableview looks like this: In another view, I use the same data, but this time want only a list of the section headers, represented by the attribute "activityCategory". I expected it to be a simple matter, but

iOS - Managing two CoreData models with MagicalRecord

你说的曾经没有我的故事 提交于 2020-01-06 08:39:21
问题 I'm using MagicalRecord to work with a CoreData model, which is likely to be versioned in the future. Now I need to add to my app a pre-populated database with one entity of about 80000 objects; this data is static and I'm not expected it will ever change. If I added this entity to the existing model I would need to generate a new seed db every time the model changes, increasing the project complexity. A better solution would be creating a second model, just for the new entity: the seed db

Error 133000 when using multiple contexts with core data

大憨熊 提交于 2020-01-04 05:03:06
问题 I've spent days trying every possible solution I can think of to this problem, but nothing seems to be working. I run a background thread like this: [MagicalRecord saveInBackgroundWithBlock:^(NSManagedObjectContext *localContext) { Media *localMedia = [media inContext:localContext]; UIImage *image = localMedia.thumbnail; dispatch_async(dispatch_get_main_queue(), ^{ [thumbnails setObject:image forKey:[NSNumber numberWithInt:i]]; [contentDict setObject:thumbnails forKey:@"MediaItems"]; [cell

NSFetchedResultsController feeding table view while background update of same persistent store causes deadlock

好久不见. 提交于 2020-01-01 16:57:53
问题 Still working on converting an app over from downloading information every time it uses or displays it, to caching it on-phone using CoreData (courtesy of MagicalRecord). This is on iOS 7 Because we don't have a data-push system set up to automatically update the phone's cached data whenever some data changes on the backend, I've been thinking over the last many months (as we worked on other aspects of the app) how to manage keeping a local copy of the data on the phone and being able to have

Using magicalrecords library in custom static framework iOS

二次信任 提交于 2020-01-01 06:08:28
问题 I've been implementing a custom static framework for iOS. Everything is working well, but now I realized that I need a store information via coredata in the framework. I've been using the magicalrecord library with my previous projects and I was wondering if anyone has any experience integrating magicalrecord into your own custom static framework. When ever I call the setupcorestack method inside my framework code nothing happens. 回答1: Here's how we've done it: // 1: Note that all setup is