realm

Computed property as in predicates, and as sortProperty in RealmSearchViewController?

[亡魂溺海] 提交于 2019-12-07 08:22:07
问题 I have a realm object Song with dynamic var title = "" . I've written a computed property, sortedName that sorts out any pesky prefixes like "The " or parentheses and punctuation. I want my RealmSearchViewController to use sortedName as its sortProperty but this is throwing the error: "Property 'sortedName' not found in object of type 'Song'" I get the same error when using sortedName in predicates (such as if results.objects(with: NSPredicate(format: "sortedName BEGINSWITH %@", key)).count >

How to add existing objects on a new class on Realm Migration in Android

前提是你 提交于 2019-12-07 07:30:51
问题 I have an app on production, so changes has to be applied with a RealmMigration I've looked the documentation and this example but I didn't find how to do the following. In current version I have items of type Foo that has a boolean property called favorite . Now I want to generalize that and create user custom Foo lists, so the users will be able to create their custom lists and add as many objects as they want. I want to implement this with a new class called UserFooList with basically name

Realm Object returning nil (Swift)

久未见 提交于 2019-12-07 06:52:19
问题 I have a custom polygon object so I can save map overlays to Realm. I'm able to create this objects successfully, but when I want to retrieve the var polygon object it returns nil. When I print the polygon object, it prints it out fine, with all the data. This is a sample of what it prints out. CustomPolygon { name = Polygon1; id = p1; polygon = Polygon { coordinates = RLMArray <0x7f928ef36230> ( [0] Coordinate { latitude = -36.914167; longitude = 174.904722; }, [1] Coordinate { latitude =

Realm - Realm.init(this) failed in onCreate?

落花浮王杯 提交于 2019-12-07 06:26:09
问题 I put Realm.init(this) in the onCreate of my Application class. But it throws an exception while I'm calling Realm.getDefaultInstance() in the onCreate of my Activity. at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2511) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1360) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app

realm in Xamarin, System.EntryPointNotfoundException when trying to use realm

若如初见. 提交于 2019-12-07 05:40:49
问题 I have installed realm in a Xamarin app and when I try to use an object (count, write, etc) it gives me a System.EntryPointNotFoundException . Below code: _realm = Realm.GetInstance(); _realm.Write(() => { var myConfig = _realm.CreateObject<Config>(); myConfig.Email = ""; myConfig.User = ""; }); System.EntryPointNotFoundException: shared_realm_begin_transaction at at (wrapper managed-to-native) Realms.NativeSharedRealm:begin_transaction (Realms.SharedRealmHandle) at Realms.Transaction..ctor

Proper way to abstract Realm in Android apps

扶醉桌前 提交于 2019-12-07 04:45:11
问题 I'm trying out Realm.io in an Android app, though, to stay on the safe side, I would like to abstract the DB layer so that, in case of need, I can switch back to a standard SQLite based DB without rewriting most of the app. I'm however finding it difficult to properly abstract Realm due to it's particular nature: When tied to a realm, RealmObjects are proxies so I cannot pass them around as they were POJOs. All Realm instances need to be properly opened and closed for every thread they are

This method is only available in managed mode

孤街醉人 提交于 2019-12-07 04:26:25
I'm develop an Android app with Realm integrated and I have a problem when I try to search with a query. I try to search a product by its "id" into product list passed by parameter. This method worked perfect but suddenly I got the next exception: Process: com.singularfactory.ecommerceapp.ecommerceapp, PID: 9372 io.realm.exceptions.RealmException: This method is only available in managed mode at io.realm.RealmList.where(RealmList.java:260) at com.singularfactory.ecommerceapp.utility.UtilityDB.findProductIntoChildrenByEntityId(UtilityDB.java:176) at com.singularfactory.ecommerceapp.fragment

Writing and reading between threads with Android Realm

筅森魡賤 提交于 2019-12-07 04:12:40
问题 I'm performing some investigation of Realm threading and encountered issue. In this simple example I have 2 Thread objects, one for writing and second one for reading. The reader Thread gets count of written objects always as 0, but inside writer scope the size() for items in DB is correct. When I relaunch app, the reader gets the first count ok before any insertions. Thread writer = new Thread() { @Override public void run() { while (mRunning) { try { Realm r = Realm.getInstance(context,

Migration on Realm 0.81.1

断了今生、忘了曾经 提交于 2019-12-07 04:06:38
问题 Got different exception after adding objects. migration needed class not found in scheme version on disk is newer than requested What is wrong? 1 - MainActivity.java RealmConfiguration realmConfiguration = new RealmConfiguration.Builder(context) .build(); Realm.setDefaultConfiguration(realmConfiguration); Realm realm = Realm.getDefaultInstance(); realm.executeTransaction(new Realm.Transaction() { @Override public void execute(Realm realm) { RealmTestObjectOne testObjectOne = new

Why is it recommended practice to store images on disk rather than in a Realm

為{幸葍}努か 提交于 2019-12-07 03:13:25
问题 I am using Realm as the database solution for my app. I need persistent storage ability for my images so I can load them when offline. I also need a cache so I can load the images from there rather than fetching them from the API each time a cell draws them. My first thought was that a Realm database could serve both of these functions just fine if I were to store the images in Realm as NSData. But I have found two answers on SE (here and here) that recommend not doing this if you have many