magicalrecord

iOS Magical Record & SQLCipher

三世轮回 提交于 2019-12-03 14:23:54
I m using Magical Record for saving my data. This data needs encryption, so i m trying to combine it with SQLCipher library( http://sqlcipher.net/ios-tutorial/ ). I already setup SQLCipher and tested it with Core Data successfully, using EncryptedStore file from this example https://github.com/project-imas/encrypted-core-data : What i did was only changed NSPersistentStoreCoordinator like this: NSPersistentStoreCoordinator *coordinator = [EncryptedStore makeStore:[self managedObjectModel]:[SSKeychain passwordForService:myservice account:myaccount]]; So i think i need to change how

Magical Record not saving

淺唱寂寞╮ 提交于 2019-12-03 14:21:41
I am using Magical Record: https://github.com/magicalpanda/MagicalRecord I am trying to save records that I get the from my website to the sqllite database using Magical Record and Core Data, but I keep getting the error: MR_saveWithErrorCallback:](0xaaa6bd0) NO CHANGES IN CONTEXT <NSManagedObjectContext (0xaaa6bd0): *** BACKGROUND SAVING (ROOT) ***> on *** BACKGROUND THREAD *** - NOT SAVING Here is the code: for(int i = 0; i < count; i += 1) { // results = array of all services from site NSDictionary * result = [results objectAtIndex: i]; NSNumber * sid = @([[result objectForKey: @"id"]

MagicalRecord relationship mapping duplicates objects despite primary keys

北城余情 提交于 2019-12-03 08:09:38
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 got an NSManagedObject Parent which has a to-many relationship with a Child NSManagedObject. The

Magical Record and iCloud enabling/disabling

霸气de小男生 提交于 2019-12-03 08:05: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 Implementing a switch to enable or disable iCloud in your app is also much easier in iOS 7, although it probably isn’t

Magical Record, saving, and NSFetchedResultsController

夙愿已清 提交于 2019-12-03 07:05:07
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 is saved using [[NSManagedObjectContext MR_contextForCurrentThread] MR_save] The

Magical Record - fetch in main thread block ui, in background return nil

余生颓废 提交于 2019-12-03 06:25:40
问题 I'm new to Magical Record, but already have seen a few questions on stackoverflow, and can't find an answer to my question. I have to find items with the predicate using this type of construction: NSArray *result = [MOSomeItems MR_findAllWithPredicate:predicate]; On the main thread result returns some value, but the UI is freezing. When using this construction, result returns nil value: dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSArray *result =

MagicalRecord: multiple databases

时光毁灭记忆、已成空白 提交于 2019-12-03 06:14:49
I have an app that uses MagicalRecord, and I'm pre-populating the database with a large amount of data that is used for reference. Within that same data model, I have user-definable information pertaining to things the user may do in the app. The app was rejected because the pre-populated data is supposed to be marked as "do not backup". So, I'd like to have that data in a separate datastore so that I can keep the user data as backupable. Is there a way to have two separate datastores using MagicalRecord? I think it's possible, but not too easy though. As you know, to work with more than one

*** Assertion failure in +[NSManagedObjectContext MR_defaultContext] when trying to truncate

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am getting an exception with MagicalRecord version 2.0.7 whenever I launch the app, it crashes with this exception: *** Assertion failure in +[NSManagedObjectContext MR_defaultContext] I am configuring coredata like this: In appdelegate didFinishLaunchingWithOptions method: [MagicalRecord setupCoreDataStack]; In appdelegate applicationWillTerminate: [MagicalRecord cleanUp]; I noticed the crash occurs only when I try to truncate all records from an entity: NSManagedObjectContext *localContext = [NSManagedObjectContext MR

Magical Record - fetch in main thread block ui, in background return nil

让人想犯罪 __ 提交于 2019-12-02 19:50:46
I'm new to Magical Record, but already have seen a few questions on stackoverflow, and can't find an answer to my question. I have to find items with the predicate using this type of construction: NSArray *result = [MOSomeItems MR_findAllWithPredicate:predicate]; On the main thread result returns some value, but the UI is freezing. When using this construction, result returns nil value: dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ NSArray *result = [MOSomeItems MR_findAllWithPredicate:predicate]; }); What is the best practice for fetching data in

Core Data concurrency `performBlockAndWait:` NSManagedObjectContext zombie

半腔热情 提交于 2019-12-02 13:13:40
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 ([task.result isKindOfClass:[NSArray class]]) { NSArray * records = (NSArray *)task.result;