realm

RLMArray - retrieve Array from Object

☆樱花仙子☆ 提交于 2019-11-28 06:45:48
问题 My model: Conv.h #import <Realm/Realm.h> #import "ConvText.h" @interface Conv : RLMObject @property NSInteger c_id; @property RLMArray<ConvText> *cts; @end ConvText.h #import <Realm/Realm.h> @interface ConvText : RLMObject @property NSInteger ct_id; @property NSInteger time; @end RLM_ARRAY_TYPE(ConvText) When I'm trying to extract ConvTexts from Conv : Conv *c = [Conv objectsWhere:@"c_id = %@",@(1)]; ConvText *ct = [c.cts arraySortedByProperty:@"time" ascending:NO][0]; <-- I get this message:

Realm: working with Clean-Architecture and RxJava2

ε祈祈猫儿з 提交于 2019-11-28 06:39:23
A bit of context, I’ve tried to apply some clean-architecture to one of my projects and I’m having trouble with the (Realm) disk implementation of my repository. I have a Repository which pulls some data from different DataStores depending on some conditions (cache). This is the theory, the problem comes when mixing all of this with UseCases and RxJava2. First I get the list of objects from Realm and then I manually create an Observable of it. But the subscribe (as expected) is executed on a different thread so realm ends up crashing… (second block of code) This is the code I use to create the

Swift Realm filter List property using an Array

我是研究僧i 提交于 2019-11-28 06:05:52
问题 I have this property in my Realm Object var tags = List<Tag>() "tags": [ { "tagId": "80069", "tagName": "A" }, { "tagId": "80070", "tagName": "B" }, { "tagId": "80071", "tagName": "C" }, { "tagId": "80073", "tagName": "D" } ] I have a view controller that can filter out the tag. So i have several buttons to toggle the filter. What I have done is i create an array for the filter for each of my button var filteredList = [String]() So, if i click Button A, it will append "A" to the filteredList

Realm - Share Database between Apps

蹲街弑〆低调 提交于 2019-11-28 05:00:47
问题 So I have a application that is comprised of 3 APK/Apps. How do I share the database between apps? I am assuming the reason it is currently not visible between the apps is because they are passing in different contexts. Thanks 回答1: Christian from Realm here. Currently what you are asking is really not feasible. As others have pointed out there is really only two approaches. 1) Expose a ContentProvider. However that require you to map RealmResults to a Cursor which is not a trivial effort. We

Android Realm large file size

强颜欢笑 提交于 2019-11-28 04:00:07
问题 I am new to android programming. I implemented Realm for my simple grade tracker, however, the file size has grown from 1.5mb to 5mb. Is that normal? What I simply did was add in an instance of realm on every class with oncreate, added in realm.close() whenever there was a chance that the activity would end. Also wrapped the begin and commit transaction around each object creation. Is there something I did wrong that ended up with the massive file size? Thanks! Edit: I mean apk size 回答1:

Swift Realm Property '*' has been added to latest object model MIGRATION

我怕爱的太早我们不能终老 提交于 2019-11-28 03:25:35
问题 I have added new array attribute to the RLMObject and public class Student: RLMObject { dynamic var id = 0 dynamic var name = "" dynamic var resultList = RLMArray(objectClassName:Result.className()) } public class Result: RLMObject { } ERROR Log: Migration is required for object type 'Student' due to the following errors: - Property 'resultList' has been added to latest object model. TRY Failed: let configuration:RLMRealmConfiguration = RLMRealmConfiguration.defaultConfiguration() migration

Android Realm - findAll returns objects with null parameters [duplicate]

*爱你&永不变心* 提交于 2019-11-28 03:13:20
问题 This question already has an answer here: Cannot retrieve field values from realm object, values are null in debugger 3 answers I need to do a simple query in Realm, retrieve a list of MyModel object and later use it somewhere else in my app. It happens that once I query Realm, each object has null values, but the toString returns the expected values. Model: @RealmClass public class MyModel extends RealmObject implements Serializable { public static final String KEY_MODEL = "key_myModel";

Realm query with List

左心房为你撑大大i 提交于 2019-11-28 03:04:44
问题 I'm using realm to store my data on Android. Awesome framework! Now the only problem I'm now having is: I got a array list strings with id's of Countries in my database. Now I retrieve my Drinks that contains a relationship to countries. Is there a way that I could to do a query like this: String [] ids; realm.where(Drinks.class).equalsTo("country.id", ids); Something like that? Or do I really need to do a query to get me all drinks and then filter the list manually? EDIT: My classes: public

Proper Realm usage patterns/best practices?

廉价感情. 提交于 2019-11-28 02:50:50
We're in the process of converting a project to use Realm. We're really impressed so far especially with the Realm Browser (so handy!). As a result, a few questions have come up and we'd like to get some concrete usage patterns down before going any further. Our app is heavily multi threaded (API calls, animations, etc), so keep that in mind when reading the questions, since I know Realm instances cannot be accessed across threads (currently). How worried should we be about repeatedly creating instances of Realm? What is the overhead? Should we bother retaining Realm instances in

Realm Change Listener with RealmResults not being called

孤人 提交于 2019-11-28 01:35:18
问题 I'm using Realm 3.0.0 I'm fetching some objects from Realm and trying to add onChangeListener, but it does not get fired when an object is changed Here's the code, am I missing something here? RealmResults<Record> realmResults = RealmManager.recordsDao().loadRecords(); realmResults.addChangeListener(new RealmChangeListener<RealmResults<Record>>() { @Override public void onChange(RealmResults<Record> element) { for (int i = 0; i < recordList.size(); i++) { if (collection.get(i).getId().equals