magicalrecord

RestKit, Core Data, Magical Record, Lots of data and Lagging UI

不羁的心 提交于 2019-12-12 01:54:51
问题 I got an app which stores data about restaurants. Their menu, schedule and so on. Theres ~200 restaurants in the DB by now. The app used to retrieve those places by a single shot, but it was taking too much time to load, so i decided to load the data one by one. On the start app asks the server for an array of place's ids, then get the data via API. I set completion blocks for RK's operations to background queues, but it didn't help. Scrolls are running not smoothy enough and sometimes the

MagicalRecord finish block before everything is saved on import

蹲街弑〆低调 提交于 2019-12-11 14:37:37
问题 When someone logins my app, a call with a JSON response is made, and I use this data to import it into Core Data with MagicalRecord. After all importing is done, a block named success is called to let my LoginViewController know everything was fine, and stopping the UIActivityIndicatorView , so it can make a segue. It Segue to a new ViewController and it has a UITableView to display the freshly imported data. My problem is, that this success block is been called before MagicalRecord is done

Using MagicalRecord to prepopulate a database (swift). -wal journal created, however, data not copied to database

白昼怎懂夜的黑 提交于 2019-12-11 14:06:43
问题 (Forgive me since I am not use to posting here. Will do my best) I am working on an iOS application that will be using a pre-populated database. In my workspace, I have a project for the iOS app and a separate command line tool project to populate the database. I have dragged the database file from the "/Library/Application Support" folder into my iOS project (without using the "Copy Items If Needed"). So when there is a change in the data or additional data is required, I can just run the

'CoreData could not fulfill a fault' error with MagicalRecord

我的未来我决定 提交于 2019-12-11 12:41:37
问题 I am working with MagicalRecord 2.2. Sometimes I receive 'CoreData could not fulfill a fault' crash in production code and I've created some test code to investigate this problem. Here is its description. I have an entity "Object". At the start, I create one object on main thread, then I call [MagicalRecord saveWithBlock:...] where I fetch this object from local context and delete it. I added extra logging to the method (NSManagedObjectContext+MagicalSaves.m) (void)MR_saveWithOptions:(

Core Data - Why isn't inverse relationship set automatically?

孤人 提交于 2019-12-11 11:35:57
问题 I have a a one-to-many relationship as an NSOrderedSet on an NSManagedObject . When the addObject: method is called on the ordered set (which I'm calling from a property on an NSManagedObjectModel subclass object), however, the inverse relationship is not being set automatically. What can cause this? As a related note, I am using Magical Record to make it easier to map data to the NSManagedObject objects. Further, I've also referred to this post, but I'm not overriding these methods on my

Multithreading violation core data

那年仲夏 提交于 2019-12-11 08:49:29
问题 I have an app where I download the data on startup using a list of operations and it crashes randomly for unknown core data reasons so I spent few days on checking the best practices to update/fetch data in multithreading core data with MagicalRecord. One of the options was to enable the multithreading debugger -com.apple.CoreData.ConcurrencyDebug 1 where Xcode stops the apps when it violates one of their rules. So, Xcode stops my app on this line [SyncRequestEntity MR_createEntityInContext:

Destroying an object in Core Data before it's saved

隐身守侯 提交于 2019-12-11 07:56:24
问题 If I create a new Custom Object in Core Date (using Magical Record) like so List *list = [List MR_createInContext:_managedObjectContext]; And then I perform various actions on it, such as setting its name list.name = @"Foobar List"; But then the user decides to cancel the creation of this list, do I need to delete? As in, is this list already in memory even though I haven't saved the local context with [localContext MR_save]; 回答1: If you create the object in the managed object context, it

Changes when record was created in today extension and updated in app are not visible in today extension

别等时光非礼了梦想. 提交于 2019-12-11 05:51:39
问题 Simply I have an app, and today extension. Also I have two entities: Goal and Service . @objc(Goal) class Goal: NSManagedObject { @NSManaged var identifier: String @NSManaged var startDate: Date @NSManaged var endDate: Date private var services: [Service] { let predicate = NSPredicate(format: "date >= %@ && date <= %@", startDate as NSDate, endDate as NSDate) return Service.mr_findAll(with: predicate) as! [Service] } var duration: Int64 { return services.reduce(0) { $0 + $1.duration } } }

MagicalRecord creating won't save new data object.

跟風遠走 提交于 2019-12-11 04:06:13
问题 I have this code: HLMReferenceData *referenceDataObj = [HLMReferenceData createEntity]; [MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext){ HLMReferenceData *localReferenceData = [referenceDataObj inContext:localContext]; // Setup localReferenceData here .... } completion:NULL]; As far as I can see this is exactly in line with the examples on the net of how to create a new record using MagicalRecord. However it does not work. I get this in the log: ... +[MagicalRecord

Unit Test build failing when importing MagicalRecord

安稳与你 提交于 2019-12-11 03:46:38
问题 I have a project setup using the UnitTest template provided by Apple. Too I added MagicalRecord to Prefix header. When I am running on the device and Simulator everything is working fine. Except the Unit Tests, when I am compiling for the unit tests the build failed with the following command: 'CoreData+MagicalRecord.h' file not found . This happens in the prefix header. prefix.pch // // Prefix header for all source files of the '123tv' target in the '123tv' project // #import <Availability.h