realm

How to properly map JSON properties to model properties in Realm.create

心不动则不痛 提交于 2019-12-07 20:58:41
问题 I'm currently implementing an insert-or-update pattern with Realm by calling realm.create(T.self, value: object, update: true) . object is JSON returned from a rest call and it may contain some or all of the properties associated with that realm object. (In other words, I need to support partial updates.) In many of the JSON objects there is a key called description . Since I cannot have a Realm object subclass with a property called public dynamic var description I need to choose another

Crash when saving data to Realm in background thread. | iOS | Swift 4.2

孤人 提交于 2019-12-07 20:47:26
DispatchQueue.global(qos: .background).async { RccContactController.shared.updateDbForAppUsers(contactModels: contacts) } DispatchQueue.global(qos: .background).async { RccContactController.shared.updateSyncStatus(lastCount : lastIndex) DispatchQueue.main.async { ContactDataStore.shared.updateContacts(withAppUsers: contacts) if let safeDelegate = RccContactController.shared.delegate { safeDelegate.syncedPhonebookContact(contacts: restContacts, appUsers: cont) } } } What's happening above: retrieving the synced contacts data from the server via Socket Update App users in DB in a background

Problems running Realm: Could not find io.realm:realm-gradle-plugin:0.88.0-SNAPSHOT

和自甴很熟 提交于 2019-12-07 18:16:46
问题 I am trying to run the example projects from the Realm git repository using Android Studio. I find that when I open any of the example projects I get the following error: Error:Could not find io.realm:realm-gradle-plugin:0.88.0-SNAPSHOT. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle-plugin/0.88.0-SNAPSHOT/maven-metadata.xml file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/realm/realm-gradle

Realm + NSTableView + NSArrayController

流过昼夜 提交于 2019-12-07 16:50:17
问题 i have some Problems with my macOS Application and hope you can help me. Im pretty new on macOS so please be nice ;) A part of the app consists of a simple NSTableView which content is binded to an NSArrayController. The NSArrayController is feeded from a realm database. As you can see there is a checkbox for each row, which should set the bool value in the realm object. The bindings are ok, so if I mark/unmark the checkbox it seems to try writing on the realm object. But since realm needs a

Nested Objects in Realm React-Native

岁酱吖の 提交于 2019-12-07 16:34:38
问题 Question How does Realm React Native perform with two way linking in parent-child nested relationships? Example I have an Invoice object, which is made up of InvoiceLines. In the old database, each row in the InvoiceLine table had a reference to its parent Invoice's ID. So a simple 'WHERE ID= " query to get from either an InvoiceLine to its Invoice or an Invoice to all of its InvoiceLines. In Realm, I'm going to have the following schema (paraphrased): class Invoice {}; Invoice.schema = {

Adding RealmSwift as a subproject: Missing required modules: 'Realm.Private', 'Realm'

≯℡__Kan透↙ 提交于 2019-12-07 14:20:14
问题 So I wanted to link to RealmSwift in my own framework and these are the steps I took: Add RealmSwift as a subproject Link the framework: Add the dependency Import RealmSwift into the Swift file: And I got the error: Missing required modules: 'Realm.Private', 'Realm' . How can I solve this issue? Thanks! 回答1: You'll need to add /path/to/RealmSwift.framework/Frameworks to the “Framework Search Paths” section in Build Settings where /path/to/RealmSwift.framework is the location of the framework.

kotlin - realm and parcel

蓝咒 提交于 2019-12-07 14:13:31
问题 I develop the android project with android studio. I want to save realm objects using onSaveInstanceState() in kotlin. My code is @Parcel( implementations = arrayOf(UserRealmProxy::class), value = Parcel.Serialization.BEAN, analyze = arrayOf(User::class)) open class User : RealmObject() { open var name: String? = null @ParcelPropertyConverter(ListParcelConverter::class) open var Items: RealmList<Item>? = null } but there are some errors while compiling: 'Unresolved reference: UserRealmProxy'

Compound key in Realm with lazy property

廉价感情. 提交于 2019-12-07 13:02:51
问题 I found this great solution for using Realm with compound primary key in Swift: https://github.com/realm/realm-cocoa/issues/1192 public final class Card: Object { public dynamic var id = 0 { didSet { compoundKey = compoundKeyValue() } } public dynamic var type = "" { didSet { compoundKey = compoundKeyValue() } } public dynamic lazy var compoundKey: String = self.compoundKeyValue() public override static func primaryKey() -> String? { return "compoundKey" } private func compoundKeyValue() ->

Getter is not associated to any field - Realm

柔情痞子 提交于 2019-12-07 09:37:16
问题 I am new to using Realm library and was trying to implement it in my android application. Just got stuck at a point where I am trying to section my listview based on the view type of a particular element in my json response . I have tried to implement the sections with recycler view but the problem is I have 2 view types and addition of headers for those view types was causing an issue. Since Realm doesn't have the support of RecyclerAdapter , I created an implementation that will use a

Build fails when using 'kotlin-kapt' with Realm

自闭症网瘾萝莉.ら 提交于 2019-12-07 08:25:47
问题 Environment : Android Studio 2.3.3, Gradle 2.3.3 and Kotlin 1.1.4-3 When I create a new Android project with Kotlin, everything works fine at first, adding //in project's build.gradle classpath "io.realm:realm-gradle-plugin:3.5.0" //in app's build.gradle apply plugin: 'realm-android' is OK. But after I add apply plugin: 'kotlin-kapt' always raising Execution failed e: Wrong plugin option format: null, should be plugin:<pluginId>:<optionName>=<value> FAILED FAILURE: Build failed with an