magicalrecord

Using magicalrecords library in custom static framework iOS

喜你入骨 提交于 2020-01-01 06:07:20
问题 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

Setting one-to-many relationship Core Data and Magical Record

爱⌒轻易说出口 提交于 2019-12-31 03:37:26
问题 If I have a Conversation entity with a one-to-many relationship to Messages (i.e. one conversation can have many messages) and I create a new message entity like so: _message = [Message MR_createInContext:_managedObjectContext]; _message set properties ... // Use this method to set relationship? [_conversation addToMessageObject:(Message *)] If I already have a _conversation object, how do I add this new message to the conversation (in other words, how do I establish the relationship)? 回答1: I

Magical Record import (next step)

只谈情不闲聊 提交于 2019-12-30 02:30:05
问题 I've put next step in the title as this is not the same problem as my previous question with almost the exact same title. I have a Person entity. Person -------- name - mappedKeyName: FullName email - mappedKeyName: EmailAddress personID - mappedKeyName: Id -------- photos And a Photo entity. Photo -------- image createDate - mappedKeyName: Date photoID - mappedKeyName: Id -------- owner (type Person) - mappedKeyName: UserId - relatedByAttribute: personID There are other objects that relate

IOS magical record create new entity and add to array not woking

为君一笑 提交于 2019-12-25 09:15:46
问题 Hi I'm working with Core Data and Magical Record. After receive JSON response from server. I want to create an entity, update its property and add to and array. My code is NSMutableArray *items = [NSMutableArray array]; NSManagedObjectContext *localContext = [NSManagedObjectContext MR_context]; Article *article = [Article MR_createEntityInContext:localContext]; [article setOrderingValue:idx]; [article updateWithApiRepresentation:articleJSON]; [items addObject:article]; I dont know why the

How to use Core Data model subclasses outside a Core Data context?

匆匆过客 提交于 2019-12-24 13:18:06
问题 I'm trying to make a weather app in Swift that will save the cities I add to Core Data, each city contain a weather object that is also saved to Core Data and other various variables. But I soon figured out, using Core Data NSManagedObjects subclasses outside a Core Data context is close to impossible (dealing with NSNumber and similar, no custom init, forced to save them somewhere, what if I stop using Core Data tomorrow, ...). So what's the best practice to keep using Core Data but also use

NSUserDefaults or something else when storing large arrays?

若如初见. 提交于 2019-12-23 19:40:51
问题 I have an app that reads JSON into in-memory objects. I have one object representing the User and then an array of custom objects. This array is ususally 20-50 objects but can be up to 7-800 in rare cases. I've read some threads about this, but find it hard to pick, since all i want to do is cache this locally, nothing more, so that i can fetch less from the server. I can see three solutions: NSUserDefaults . Not sure how app performance is affected by large array CoreData / MagicalRecord .

Magical Record deleting entity issue

隐身守侯 提交于 2019-12-23 08:17:24
问题 I have a one-to-many relationship form Feedback to Questions in Feedback. The deletion rule is set to Nullify in Question and to Cascade in Feedback (so that when Feedback is deleted it deletes all its questions and when question is deleted it is pointer set to null in feedback.questions). The problem is when I delete question (just a one question from many that exists in feedback) then I can't access feedback! Though the actual entry is really exist in DB (checked it with MesaSQLite) The

Regarding MagicalRecord, what is the difference between the methods MR_saveNestedContexts and MR_save

女生的网名这么多〃 提交于 2019-12-23 05:11:42
问题 In the MagicalRecord github docs it states: MagicalRecord provides a background saving queue so that saving all data is performed off the main thread, in the background. This means that it may be necessary to use MR_saveNestedContexts rather than the typical MR_save method in order to persist your changes all the way to your persistent store. looking at the source, I can't figure out the difference between these two methods minus the dispatch_async command. I see that they both save all

MagicalRecord — saveinBackground not persisting data?

随声附和 提交于 2019-12-23 04:49:15
问题 I'm having trouble understanding the difference betweeen [[NSManagedObjectContext defaultContext] save] and [[NSManagedObjectContext defaultContext] saveInBackground] . When I use the save functionality, it works just fine but saveInBackground never persists the data. In short, this is the difference: // Save in background.. DOES NOT WORK [[NSManagedObjectContext defaultContext] saveInBackgroundErrorHandler:^(NSError *error){ NSLog(@"FAILED TO SAVE!! Task: %@", task); }completion:^(void){

iCloud Time out. (using iCloud + Core Data + Magical Record

柔情痞子 提交于 2019-12-22 04:50:50
问题 I started an app test to use Core Data and iCloud (using Magical Records). After a lot of troubles to configure Provisioning Profiles and Entitlements, the app finally runs. After a while the app crash and throw this message:: 2012-12-31 03:42:07.079 iCloudTest[252:1103] -[PFUbiquitySafeSaveFile waitForFileToUpload:](268): CoreData: Ubiquity: <PFUbiquityPeerReceipt: 0x1cd5a420>(0) permanentLocation: <PFUbiquityLocation: 0x1cd57b30>: /private/var/mobile/Library/Mobile Documents/MA5BADG5AW~com