realm

Realm Unit Test on Android

风流意气都作罢 提交于 2019-12-10 14:21:42
问题 Trying to unit test a class that does some calls to Realm (0.87.4), the test setup fails with java.lang.NoClassDefFoundError: rx/Observable$OnSubscribe at io.realm.RealmConfiguration$Builder.<init>(RealmConfiguration.java:279) at org.testapp.db.MyClassTest.setUp(MyClassTest.java:34) ... Caused by: java.lang.ClassNotFoundException: rx.Observable$OnSubscribe at java.net.URLClassLoader$1.run(URLClassLoader.java:366) My test class starts with: @RunWith(MockitoJUnitRunner.class) public class

How to make RLMResults mutable?

会有一股神秘感。 提交于 2019-12-10 14:12:19
问题 The Realm doc says the RLMResults are lick NSArray . I have some results returned from the database and I want to merge it into another RLMResults . But it seems it's immutable, How to make a RLMResults add objects from another RLMResults ? or make it mutable? or convert it to NSArray ? 回答1: Currently this is something you would have to do manually. You could create an RLMArray by concatenating your two results. We are discussing a union/merge method further down on the roadmap for RLMObjects

Realm, Swift, Many-to-many relationship

↘锁芯ラ 提交于 2019-12-10 13:58:09
问题 On my API I've got a relationship between Stands and Products. In which stands have products, but products can be found in different stands aswell. I'm trying to replicate this relationship on my iOS-application, using Realm but I can't seem to get it working. The goal of having this relationship is being able to search for Stands that sell particular products. My model: class Stand: Object { dynamic var id : Int = 0 dynamic var name : String = "" dynamic var latitude : Double = 0.0 dynamic

Realm = RLMRealm' has no member 'setDefaultRealmPath'

南楼画角 提交于 2019-12-10 13:54:51
问题 I have added the Realm.framework and RealSwift.framework to a project. and "import Realm" though I'm getting this error: RLMRealm' has no member 'setDefaultRealmPath' let directory: NSURL = NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.it.fancypixel.Done")! let realmPath = (directory.path! as NSString).stringByAppendingPathComponent("db.realm") RLMRealm.setDefaultRealmPath(realmPath) Any ideas I can't seem to see a solution for this anywhere being it

Filtering Realm objects with Swift

前提是你 提交于 2019-12-10 13:42:11
问题 I always get the following error when trying to filter my Realm database using NSPredicate : Property 'text' is not a link in object of type 'getType' I want to filter my Realm database to show only the items that have some specific text in them. This is what I've tried: let realm = try! Realm() let predicate = NSPredicate(format: "typez.text.filter = 'special'") let filterThis = realm.objects(Publication).filter(predicate) print(filterThis) The relevant portion of my model classes is: class

Compiler Error : com.sun.tools.javac.code.Symbol$CompletionFailure: class file for rx.Observable not found

无人久伴 提交于 2019-12-10 13:38:17
问题 I was just making a basic realm file using the latest REALM version but the compiler throws this error: An exception has occurred in the compiler (1.8.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. com.sun.tools.javac.code.Symbol$CompletionFailure: class file for rx.Observable not found The app I made is still relatively

Crash combining Firebase and Realm - Failed resolution of: Lio/reactivex/Observable;

自古美人都是妖i 提交于 2019-12-10 13:23:19
问题 I am trying to download objects from Firebase and store them in Realm. I am receiving a crash when combining these two excellent libraries. I've created a very simple demo app which illustrates my problem. It seems Firebase gets upset when creating an object that extends RealmObject. I can make this work by removing the RealmObject extension but then I have to maintain two identical objects. Over time this becomes complicated and frustrating which is far from ideal. Firebase: FirebaseDatabase

Can only delete an object from the Realm it belongs to

烈酒焚心 提交于 2019-12-10 13:04:05
问题 Im getting this error " Can only delete an object from the Realm it belongs to " every time I try to delete an object from realm on my tableview. Here is the relevant code: let realm = try! Realm() var checklists = [ChecklistDataModel]() override func viewWillAppear(_ animated: Bool) { checklists = [] let getChecklists = realm.objects(ChecklistDataModel.self) for item in getChecklists{ let newChecklist = ChecklistDataModel() newChecklist.name = item.name newChecklist.note = item.note

Check two fields with Realm database

喜夏-厌秋 提交于 2019-12-10 12:40:02
问题 How can I create an and operation with Realm? Example I have an object with day and month and I want to check both those fields values. Something like : RealmResults<Event> toEdit = realm.where(Event.class) .equalTo("day", day) .and .equalTo("month", month) .findAll(); But as far as I can tell there is no and operator. Thank you 回答1: Multiple conditions are combined with And unless there's an .or() between them, so it's just: RealmResults<Event> toEdit = realm.where(Event.class) .equalTo("day

Can “data at rest” in the Realm Mobile Platform be encrypted?

允我心安 提交于 2019-12-10 11:55:18
问题 Realm supports encrypting the database file on disk with AES-256+SHA2 by supplying a 64-byte encryption key when creating a Realm. Since the Realm Mobile Platform is self hosted (inhouse or via cloud) - does that effectively also mean that this same database file encryption is available ? I'm assuming 'yes' but since I was always taught "never assume" I wanted to ask the question here. 回答1: Yes, the same encryption is also available for synched Realms. However, note that if you supply an