magicalrecord

Magical Record and iCloud enabling/disabling

时光总嘲笑我的痴心妄想 提交于 2019-12-04 12:33:37
问题 How to handle correct the following flow using Magical Record ? Assume that my app enable feature to switch iCloud sync on/off. The user installs the app. On startup he is asked about iCloud preference. His choice: do not use iCloud. The user creates some data in the app. Then he decides to store it in iCloud and enables iCloud. Later by some reason the user disables iCloud in the app. Data should be left locally. How to setup Magical Record correctly? UPDATE: Source code 回答1: Implementing a

MagicalRecord relationship mapping duplicates objects despite primary keys

不问归期 提交于 2019-12-04 12:31:51
问题 I'm in need of some assistance for an issue I am experiencing with MagicalRecord data importing. I was under the impression that MagicalRecord was able to handle relationship mapping without duplicating objects by looking at the primary keys ( relatedByAttribute ). Here's a simple JSON: [ { parentId: "<unique id>", parentName : "<name>", children : [ { childId: "<unique id>", childName: "<name>" }, { childId: "<unique id>", childName: "<name>" } ] }, { <another parent with children> } ] I've

Importing Data using MagicalRecord

余生颓废 提交于 2019-12-04 07:35:07
I'm using MagicalRecord to import data from plist. I'm using code less import as explained in this tutorial Importing Data Made Easy . I have two entities Manufacturer and Car, they have one to many and one to one relation respectively. Plist structure This import work fine NSArray *manufacturers = ... [MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) { [manufacturers enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [Manufacturer MR_importFromObject:obj inContext:localContext]; }]; } completion:^(BOOL success, NSError *error) { }]; But this is not getting

Error creating a separate NSManagedObjectContext

你离开我真会死。 提交于 2019-12-04 05:16:03
问题 Before getting into my issue, please have a look at this image. Here is the actual data model: I retrieve a set of Records from a web API, create objects out of them, save them in core data and display them in the Today view. By default these records are returned for the current date. The user can tap on Past button to go to a separate view where he can choose a past or future date from a date picker view and view Records for that selected date. This means I have to call the API again passing

Coredata crash while fetching

我与影子孤独终老i 提交于 2019-12-04 04:11:32
I am getting some weird coredata error in the production app and I was able to get hold of the Crash Report. Its Crashing with the following message at times *** error for object 0x17e400000: Freeing unallocated pointer *** error for object 0x17fd03730: pointer being reallocated was not allocated And here is the stack trace Crashed: SQLQueue 0x13ff15250 for datastore.sqlite SIGABRT ABORT 0x0000000183986014 0 libsystem_kernel.dylib __pthread_kill + 8 1 libsystem_pthread.dylib pthread_kill + 112 2 libsystem_c.dylib abort + 140 3 libsystem_malloc.dylib _nano_vet_and_size_of_live + 330 4 libsystem

UICollectionView with Multiple subclassed UICollectionViewCell

匆匆过客 提交于 2019-12-04 02:38:50
I have multiple sections in my UICollectionView grouped by "datasetType". I also have a custom UICollectionViewCell for each section. How can I determine which custom UICollectionViewCell I need in the cellForItemAtIndexPath method? My first though was go to based of the [sectionInfo name] : id sectionInfo = [[self.fetchedResultsController sections] objectAtIndex:indexPath.section]; if ([[sectionInfo name] isEqualToString:@"DatasetA"]) { DatasetACell *datasetACell = [collectionView dequeueReusableCellWithReuseIdentifier:datasetACellIdentifer forIndexPath:indexPath]; DatasetA *datasetA = [self

Disable MagicalRecord error messages and warnings

情到浓时终转凉″ 提交于 2019-12-04 00:41:55
I just started using MagicalRecord, and this might be a stupid question, but it's really bothering me... I am using MagicalRecord with sqlite, and when I initiate MagicalRecord, I used [MagicalRecord setupCoreDataStackWithStoreNamed:@"OrderSystem.sqlite"]; and it produced the following messages: 2012-10-16 16:54:48.966 OrderSystem[4135:c07] +NSManagedObjectContext(MagicalRecord) MR_contextWithStoreCoordinator: -> Created : Context * MAIN THREAD * When I tried to store my entity with the following code using a background thread: [MagicalRecord saveInBackgroundWithBlock:^(NSManagedObjectContext

Using an existing SQLite database in MagicalRecord

纵饮孤独 提交于 2019-12-03 21:56:50
问题 I've created a SQLite database that contains records from some JSON using this tutorial, and I want to use MagicalRecord to query it. MagicalRecord sees the NSManagedObject ( BlogPost ) and can create records, but it doesn't see the prepopulated records, so I'm guessing it's not seeing the SQLite file I've added. I've verified that the SQLite database does indeed contain rows using a SQLite client. In application:didFinishLaunchingWithOptions: , I've put: [MagicalRecord

Using magicalrecords library in custom static framework iOS

♀尐吖头ヾ 提交于 2019-12-03 17:11:05
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. JRG-Developer Here's how we've done it: // 1: Note that all setup is done within the AppDelegate of the project (not the framework) - (BOOL)application:

How do I set up Core Data lightweight migration using MagicalRecord?

泪湿孤枕 提交于 2019-12-03 14:46:30
I have hit a brick wall trying to setup lightweight migration of Core Data using MagicalRecord. I have looked at all of the posts on this subject, using Google and SO. I understand how the persistentStoreCoordinator works and what the settings I am trying to make also do. Here's my code: AppDeligate.h NSPersistentStoreCoordinator *persistentStoreCoordinator; AppDelegate.m - (NSPersistentStoreCoordinator *)persistentStoreCoordinator { if (persistentStoreCoordinator != nil) { return persistentStoreCoordinator; } NSURL *storeUrl = [NSURL fileURLWithPath: [[self applicationDocumentsDirectory]