FAQ Database Discussion Community


RealmBaseAdapter with section headers

android,listview,realm
I'm trying to use the realm data store for Android and i'm trying to build an application that shows the user a list of options in a ListView, kind of like the users contact list. The first letter for each section (such as A, B, C, etc.) should be a...

From SQL Foreign keys to Realm References?

json,realm
We have a PostgreSQL server-side DB. We download table rows to the tablet through JSON strings. Now we are migrating to Realm and are now facing the Foreign Keys problem right now. How does Realm manage this?. I mean, our shema has a lot of references in many different tables...

Is possible to save Realm documentation for offline reading?

android,ios,documentation,realm
I'm going to vacations this Saturday and I need to have Realm API documentation available for offline reading (https://realm.io/docs/swift/latest/api/index.html). Does it exist somewhere for download? Thanks

Realm swift creates objective c files

objective-c,swift,realm
I just started working with realm in my project. I have a Cocos2D game project, created with spritebilder. The code is in swift, except the appdelegate, which I don't know why, is in objective-c. I just added, folowing thi instructions https://realm.io/docs/swift/latest/, realm to my project. I hope i got all...

How I can use Realm to parse a large JSON and storing data

android,json,android-volley,realm
J'm really blocked into parsing and storing data using Realm,I have a large JSON and I creat all the class models like the example of RealM. this is my error :Caused by: org.json.JSONExcept ion: Value fr at 0 of io.realm.exceptions.RealmException: Could not map Json at io.realm.Realm.createObjectFromJson(Realm.java:860) at com.example.volleyapp2.ImagesActivity$ImagesFragment.loadData(ImagesActivity.java:179) at com.example.volleyapp2.ImagesActivity$ImagesFragment$2.onResponse(ImagesActivity.java:133)...

Realm lexical or preprocessor 'RLMAccessor.h' file not found

ios,xcode,realm,ocmock
I wanted to write some unit tests using GRUnit & OCMock for an app using Realm. Even though the pods are installed and the paths should be correctly set, Xcode can't seem to find a number of files like RLMAccessor.h. I get an "lexical or preprocessor issue" I've tried a...

'Realm accessed from incorrect thread' error in prepareForSegue; Swift

ios,multithreading,swift,grand-central-dispatch,realm
What am I doing wrong that would cause a 'Realm accessed from incorrect thread' error? 2015-03-14 06:59:54.962 MyApp[25646:1218284] *** Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread' *** First throw call stack: ( 0 CoreFoundation 0x01961466 __exceptionPreprocess + 182 1 libobjc.A.dylib 0x01212a97 objc_exception_throw + 44...

Realm manual install issues on iOS

ios,realm
I followed the instructions on the doc page to get the manual install working. And it is working, however, when I tried to push to my repo, the repo rejected my push. I checked why this might be, and I found that there was a large file, 46 MB or...

In Java, How do I cast a Realm Object into the class I wish to write to the Database?

android,class,object,casting,realm
I am currently working on a project where my Database has a very large number of tables (Approx 60 total). I am working to create the Database Helper class that will function as the writer/ reader to/ from the database. And example of my write method would be this: public...

Realm: Module was created by an older version of compiler and could not build objective-c module

ios,swift,realm
I have followed the steps provided to add the framewowrk from this link https://realm.io/docs/swift/latest/ It gives this error what could be the issue? Is it because it is compiled with an older version of xcode, since I have the latest xcode 7 beta? If so, how would I solve...

Refreshing multiple Realm instances at once?

java,android,multithreading,realm,event-bus
I'm using a setup in which every Presenter that is a retained Fragment has its own Realm instance. However, this essentially means that these Realms are all on the main thread. Now that also means, if I want to modify the Realm, I either need to do that on the...

Assigning property to subclass of RLMObject

realm
I'm trying to use a subclass of a RLMObject as a base class for a property of other subclass of RLMObject, with no luck. Is this a known restriction, or is there a workaround for it? test.m: #import <XCTest/XCTest.h> #import <Realm/Realm.h> @interface Base : RLMObject; @end @interface Derived : Base;...

adding and removing Realm.Object during a migration

swift,migration,realm
I am doing a migration which requires removing objects from the realm and replacing them with a different type. In short, I used to have a single type, and am now creating a hierarchy, so BaseItem now needs to be a DerivedItem. I'm not sure the best way to accomplish...

Updating an object on realm

ios,realm
I want to update an object with realm. But my app is crashing. My code: var findConversations = ShufflePerson.objectsWhere("receiver='\(from)'") var shuf = findConversations[0] as! ShufflePerson shuf.unreadMessage=shuf.unreadMessage++ self.realm.beginWriteTransaction() self.realm.commitWriteTransaction() Crash Log: Terminating app due to uncaught exception 'RLMException', reason: 'Attempting to modify object outside of a write transaction - call beginWriteTransaction...

Sort Realm results by case insensitive property

ios,swift,realm
I'm sorting my results by a property called "alphabet" like this: allArtists = Artist.allObjects().sortedResultsUsingProperty("alphabet", ascending: true) How can I sort with case insensitive? Right now "cop" will appear before "Cat"....

Watchkit & Realm 0.92.3

ios,watchkit,realm
The Swift integration of a new Realm-DB (realm 0.92.3) under Xcode 6.3 and iOS10.10.3 basically works for the iPhone (not for the Apple-Watch yet). The integration of the same realm-framework under Watchkit (i.e. Apple-Watch) does not work yet. The RealmSwift.framework is integrated (dragged into) the Embedded-Binaries as described here1 and...

I have a model class, using which I save to realm. How do I use `contains()` to see if the object has already been stored

java,android,realm
Here's the model class - public class BasicSavedInfoImpl extends RealmObject implements BasicSavedInfo { private String iD; @Override public String getID() { return iD; } @Override public void setID(String ID) { this.iD= ID; } } Here's how I write id to realm - realm.beginTransaction(); BasicSavedInfoImpl basicSavedInfoImpl = realm.createObject(BasicSavedInfoImpl.class); basicSavedInfoImpl.setID(id); realm.commitTransaction(); How...

Meta inforation for RealmObject's entities?

android,realm
I'm working on a project with lots of seperate data. I'm not even half done and right now I have 18 different Entities. The data from these entities comes from our Internal Api. I Was trying to convert to Realm since I've implemented this with extreme ease in our swift...

Is it possible to `marshal` data into a Realm object?

ios,objective-c,cocoa-touch,realm
I have the following JSON coming from an API: { "id": "7", "first_name": "Foo", "last_name": "Bar" } And I would like my Realm object to look like this (objective-c): @interface RWUser : RLMObject @property int key; @property NSString *firstName; @property NSString *lastName; @end The point being that the property names...

Realm - array of NSString as property?

realm
Hi everyone, I'm working with Realm and I'd like to add an NSArray as one of my RLMObject's properties. I just want to store NSString in that Array, that's why I don't want to define a RLMArray property ( I don't want to create a new RLMObject equivalent to an...

Using Realm with Swift on iOS 7

ios,swift,ios7,realm
I have an app written in Swift that supports iOS 7. I want to use Realm for my database, but according to their documentation the Swift library supports iOS 8 only. I don't want to write Objective-C code in my app. Is there any way around this? ...

Return unique/distinct values with Realm query

ios,objective-c,swift,realm
I have a Message/RLMObject model that has a NSString *jabberID property/row and I want to retrieve every unique value inside that row. In other word, I want to retrieve non-repeated jabberID values from my Message model. Can anyone help out figuring this? The way I use to do with coredata...

Convert ISO 8601 strings to date in createOrUpdateInDefaultRealmWithObject

ios,json,swift,realm
I have a block of JSON returned from a REST API in the following format: [ { id: 1, locations: [ { arriveAt: "2015-03-14T16:05:16Z" }, { arriveAt: null ] }, ... ] I then have code in my project like this: let trips = json as [NSDictionary] let realm =...

realm.objects().filter does not work with Resuts

swift,realm
I tried to do query objects from Realm using RealmSwift framefowk with predicates: realm.objects(Train).filter("ANY route IN %@", realm.objects(Route)) Error is: Cannot invoke 'filter' with an argument list of type '(String, Results)' The same code worked with Realm framework but does not work with RealmSwift framework. What am I doing wrong...

How to clone a object with primary key in Realm.io (objective-c)

ios,objective-c,realm
i have an object model, with a primary key and i want to do a clone of that object with another primary key but realm.io says "this object already exist " the primary key is not the same as the first object RLMRealm *realm = [RLMRealm defaultRealm]; [realm beginWriteTransaction]; ActivityTreeModel...

Realm - Add file with initial data to project (iOS/Swift)

ios,xcode,swift,realm
I'm developing an application for iOS using swift and chose Realm as a database solution for it. I wrote default data in AppDelegate using write/add function from realm docs and it works just fine. So after first launch I have a *.realm file with my initial data. In Realm documentation...

Realm: Iterating a RealmObject and clearing an ArrayList field

java,android,iterator,realm
I have a RealmResults<Section> that has a RealmList<Event> field that I want to clear on each Section. I've tried (insude mRealm.executeTransaction) for (Section section : mSections) { section.getEvents().clear(); } and Iterator<Section> sectionIterator = mSections.iterator(); while (sectionIterator.hasNext()) { sectionIterator.next().getEvents().clear(); } but Realm throws this exception java.util.ConcurrentModificationException: No outside changes to a...

Debugging Realm in iOS 8.3

ios,swift,realm,ios8.3
I need to export .realm from Documents folder on real iOS device. Since iOS 8.3 Apple has disabled direct access to device's Documents folder how can I do that. For example I can send it by email, but is there any easier way?

Listing all records with realm causes crash

swift,realm
I am running this code for list all users in realm: override func viewDidLoad() { super.viewDidLoad() var allShuffle=ShufflePerson.allObjects() for var i = 1; i <= Int(allShuffle.count); ++i { var someIntToUInt : UInt = UInt(i); println("someun \(someIntToUInt)") let shufflePerson = allShuffle.objectAtIndex(someIntToUInt) as! ShufflePerson //If I remove this line my code is...

Limit number of calls in using Parse

android,database,many-to-many,realm
I'm building my first application with a backend. General info The app allows users to upload a place, attach tags to it, pictures, etc. Dbs I'm using Realm as an offline Db & Parse.com as online Db. Example I'm building the database model and trying to link all many-to-many relations....

RealmSwift error: “RLMException, reason: Collection was mutated while being enumerated.”

swift,nspredicate,enumeration,realm
I am getting the following error: "RLMException, reason: Collection was mutated while being enumerated." I get the error when I try to do this: let realm = Realm() let words = realm.objects(Word).filter("ANY collectedSentences.characterCount > 0") realm.write { for word in words { word.collectedSentences.removeAll() } } I don't get that error...

Query Realm for all objects based on the size of a RLMArray property?

ios,swift,nspredicate,realm
We're trying to write a Realm query to retrieve all objects where the size of a RLMArray property is a certain number. The Realm model looks like this: class Foo: RLMObject { dynamic var people = RLMArray(objectClassName: User.className()) } And multiple iterations of the query we've tried without success are...

Error on Android Realm copyToRealmOrUpdate when inserting existing records

android,realm
I've started using Realm for Android. I'm lovin' it so far, but I'm having some problems trying to understand how to use correctly the "copyToRealmOrUpdate". I will receive a JSON (that I'm mapping into a Contact RealmObject Array) with a X "contacts" every time I open the App, and I...

If I make a database on Realm, will it be accessible to my user without internet access?

ios,realm
I'm trying to build my first Swift app and I think Realm may be a good option for my database. This might be a totally stupid question, but will my users be able to access the data on my database without an internet connection? I'm fairly certain that the answer...

Realm.io - Is it possible to find object by its subobject?

android,realm
Doctor includes object Organization sub object: @PrimaryKey private int doctorId; private FullName fullName; private Age age; private Organization organization; private Position position; private String category; private String loyalty; private List<Specialization> specializations; private Contacts contacts; Organization model has following parameters: @PrimaryKey private OrganizationId organizationId; private String organizationName; private String key; //...

Unable to use both Swift and Obj-C libs with Cocoapods

ios,objective-c,swift,cocoapods,realm
I have just started a new Swift project and I would like to use different libraries. In particular, I would like to use Realm.io, an Obj-C library. But, I would also like to use pure Swift libraries such as Alamofire or Dollar. I use Cocoapods for managing my dependencies. I...

Realm access from incorrect thread Android

java,android,multithreading,realm
I am dealing with this issue on Android : Realm access from incorrect thread. Realm objects can only be accessed on the thread they where created. I want to use Realm in my RemoteViewsFactory with public class RemoteViewsX implements RemoteViewsFactory { public RemoteViews getViewAt(int paramInt) { if (this.results != null...

Fatal Error: use of unimplemented initializer 'init(realm:schema:)'

ios,swift,realm
My Issue: Yesterday, I updated my Realm framework from 0.91.5 to 0.92.0 for my project (written in Swift). I found that the Realm Team had already separated Swift part and Objective-C part from the previous entire Cocoa Framework, the team also change the syntax. And I already corrected my code...

Can I have arrayList of string in realm object android

java,android,arraylist,realm,realm-list
As we dont have any list data type in realm, how can we use ArrayList<String> in a realm object? I had same question for the arrayLists of the custom models we make i.e. ArrayList<CustomModel> but for that I understand that we first have to make RealmObject of same Custom model...

Can I store objects from android SDK like Location?

android,realm
Can I store objects from android SDK like Location in realm? If so, how can I do it? I am getting this error message Error:(14, 8) error: Type android.location.Location of field location is not supported or what could be a workaround to save a location?

Realm database layer gives error under Eclipse, Genymotion emulator and devices

android,genymotion,eclipse-adt,realm
I installed on to Eclipse ADT Realm DB (version 0.79.1) (http://realm.io/docs/java/0.79.0/) and Genymotion emulator (https://www.genymotion.com/#!/download). I've done every step of the installation. I've used Genymotion for a long time so that is fine. I've installed Realm DB and I've tried to run a example project that I've found in the...

Realm.io - Realm accessed from incorrect thread swift

ios,swift,realm
I want to download cities (name,id,lon,lat) from my .json file to Realm database. I have created Realm object called City, but it crashes with the following error: Terminating app due to uncaught exception 'RLMException', reason: 'Realm accessed from incorrect thread'** So, I just want to get a Realm objects in...

Realm `description` property behaving differently to other properties

ios,realm
Normally when you NSLog a Realm object you get something like: MPWidget { identifier: 5, title: "My widget", cost: 38 } However, if a Realm object has a description property I just see the description printed instead. Just the description, no other properties or inkling that it's a Realm object....

Delete all data from specific Realm Object Swift

swift,persistence,realm
Before i get too far into my question. My goal, which may influence your answers, is to remove Object data if it is no longer in the cloud. So if I have an array ["one", "two", "three"] Then in my server I remove "two" I want my realm to update...

Issue setting a RealmList to my database item, using Realm for android android,database,web-services,gson,realm
First I call a function that will bring back my user from the database, and after I get my updated profile from the WS, and I try to change the list of friends from the database. Method to get my user: public UserRecord getMyUser(){ String userId = PSLocationCenter.getInstance().pref.getUserId(context); RealmResults<UserRecord> completed...

Completely remove RLMObject in Realm.io

swift,realm
I see there are ways to empty an RLMObject, but I want to completely remove it from the RLMRealm storage. And I don't want to do a migration either, I want it removed. Is that possible?

Multiple Realms with multiple data models

ios,swift,realm
Is it possible to create two different realms each one using a different data model? For example: defaultRealm would use the client class as model and myRealm would use products class as model...

Realm Swift 0.92.3 “Run Script Phase” not working

ios,xcode,realm
Trying to use the new realm-swift-0.92.3, I can't get this “Run Script Phase” to work. I follow the instructions from here. My Run-Script entry according to the the instructions is (see image below): Unfortunately, I still get the following error message while trying to compile (see below). What could still...

Realm error: Invalid Value, expecting int and receiving: 0

ios,swift,realm
I am using Realm with Swift for a query, but am receiving this error: Terminating app due to uncaught exception 'Invalid value', reason: 'Expected object of type int for property 'id' on object of type 'JournalEntryLine', but received: 0' The JournalEntryLine class does have a property (Int) named id. The...

RealmMigrationNeededException when changing Realm model

android,realm
Whenever I change the model like adding more fields, the app crash with io.realm.exceptions.RealmMigrationNeededException error. This can only be resolved when I uninstalled and reinstalled the app. Any suggestion to do migration? I am using only the default instance....

Objective-C Swift interoperability with Realm

ios,swift,realm
I'm adding new functionality to an app written in Objective-C with Swift. The new features require a data base so I'm using Realm-Swift. The problem is that the models that have relationships e.g. dynamic var points = List<Point>() don't translate to Objective-C on the {Project}-Swift.h file. I get the error:...

Realm.IO - Can JSON array be parsed using createOrUpdateAllFromJson?

android,json,realm
Inside Doctor class, I have RealmList - specializationList. public class Doctor extends RealmObject { @PrimaryKey private String doctorId; private FullName fullName; private Age age; private String organizationId; private Position position; private String category; private String loyalty; private RealmList<Specialization> specializationList; private Contacts contacts; private String key; .... Specialization class public class...

Avoid Adding Repeat Object to Realm

ios,swift,parse.com,realm
I query down the data from Parse.com and save them in the local Realm database (iOS/swift). Each object has a unique property(A) but also a might-be-same property(B). What is the most efficient way to avoid adding objects with same property B into the realm database? Thanks in advance.

iOS framework that dynamically links against Realm

ios,xcode,frameworks,realm
I am currently creating a framework for iOS and I want it to link against the Realm framework dynamically. Here are some steps I took to do this but with no success: Add the Realm project into my Xcode project (I want to build Realm from source). In the Xcode...

Realm: query with property aggregation

ios,cocoa-touch,swift,realm
I have 2 objects: Person and Transaction. Person can have multiple transactions (1-many). Now I want to get all persons, who have sum(transactions.amount) > 0. How can I do it most efficient way? My models setup: class Person: RLMObject { dynamic var name = "" dynamic var transactions = RLMArray(objectClassName:...

Realm not writing correctly

ios,swift,cocos2d-iphone,realm
I've been trying to use Realm to create a db for my cocos2d game, but can't figure out some problem. I'm using Realm Objective-C 0.92.3 (https://realm.io/docs/objc/latest/) since I need my game to work on iOS 7 or later. I've been using some small code to write and read but somehow...

Gson deserialization of List into realmList

java,android,gson,retrofit,realm
I'm using retrofit with gson to deserialize my json into realm objects. This works very well for the most part. Trouble arises when dealing with RealmList(String(or any other basic data type)) Since Realm doesnt support RealmList where E doesnt extend Realm object, I wrapped String in a RealmObject. public class...

Android Realm Retrofit relationship error

java,android,gson,retrofit,realm
I am having an issue getting all of my POJOs and everything setup so that it parses my JSON correctly. I am fairly new to Android development so the fix could be something simple. I was able to get this to work without Realm. I think modified my POJOs to...

RETROFIT POST Realm object

android,retrofit,realm
I have the following RETROFIT API: @POST("/payments") Observable<Response> saveCreditCard(@Body CreditCard creditCard) CreditCard is a RealmObject. When I try to use my API method: CreditCard card = realm.createObject(CreditCard.class); card.setWhateverField(...); ... mApi.saveCreditCard(card) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(...); I get the following error: > retrofit.RetrofitError: com.fasterxml.jackson.databind.JsonMappingException: Realm access from incorrect thread. Realm...

Realm.io API mapping parent object automatically

swift,realm
I am using Realm and its REST API's mapping method to map JSON data to my models and their child relationships automatically. It works great, except when I add in a "To-One" relationship on the child models referencing the parent. The mapping goes all out of whack and creates additional...

I have problems adding a RealmObject that contains a RealmList of LatLng

android,database,sqlite,realm
I know I need to extend RealmObject on all the objects that I have in realm, in order to create the database, but I use google maps and so I have a list of LatLng's in a object that I need to store in Realm. The LatLng is a google...

Realm 0.92 with swift get object at index

ios,swift,realm
i am new to realm with swift and just installed the new version of it and the objectAtIndex is not available like it used to be in the version before it. i am working with iOS 8 and Xcode 6 On realm 0.92 how do you get the object at...

Unable to invoke max with an argument list of type String

swift,realm
I'm starting to try realm with swift and have some basic difficulties. This is my model: class Alarm: Object { dynamic var id: Int = 0 dynamic var name: String! dynamic var date: NSDate! override static func primaryKey() -> String? { return "id" } } Now I want to calculate...

How to have List property?

ios,swift,realm
How do I have a List property in a Realm object? I want to save the strings to the same object not to have related objects each having a single string (which I assume happens if I use some StringWrapper class).

RealmResult Many-Many Relationship With Adapter

java,android,realm
I have two models who (with relevant properties) look like this: Playlist.java @PrimaryKey String id; String name; RealmList<Song> songs; Song.java @PrimaryKey String id; String name; As you can see, a playlist can contain many songs, and a song can belong to many playlists. In one portion of my app I...

How can I fix this memory issue in my maximum matching algorithm with RealmSwift?

algorithm,swift,realm,text-segmentation
I wrote my own maximum matching function in Swift to divide Chinese sentences into words. It works fine, except with abnormally long sentences the memory usage goes up over 1 gb. I need help figuring out how to modify my code so that there isn't this memory problem. I'm not...

authc filter is not calling MyRealm in shiro with spring

java,spring,security,shiro,realm
I'm working on project with spring/hibernate/jax-rs(jersey). I wanted to integrate shiro to my project. I did configurations as in documentation. I have my own implementation of Realm. Q: Problem is when authBasic path is called, it works fine with MyRealm. But when i call for authc(FormAuthenticationFilter) it shows login page...

No public RealmResults Constructor?

java,android,realm
I've got a table that has Realm Objects I'm calling Foo. One of the columns of Foo points to another Realm Object, Bar. I want to query table Foo and pick out all of the Bar objects I need, and then add them to a RealmBaseAdapter. However, to my knowledge,...

findFirst method in Realm?

cocoa,realm
I'm switching from Core Data ( Magical Record ) to Realm and I was wondering if there was an equivalent of MR_findFirst ? For now, I'm doing : if ([myRlmObject allObjects].count > 0) { myRlmObject *myFirstObject = [myRlmObject allObjects][0]; } Thanks in advance !...

Rebuild Realm Database

ios,swift,realm
I have a swift project with Realm installed via cocoapods. I accidentally deleted the realm database via rm path/to/realm/database in my terminal. Whenever I run the app I receive the error below: 'RLMException', reason: 'open() failed: No such file or directory' My questions is, how do I rebuild the realm...

Getting NullPointer adding object to RealmList

android,realm
I have a problem when I try to add a new object to RealmList in Realm database Android. Always I'm getting NullPointer error at: Global.USER_LOGGED.getProductsGrid().add(pFinal); This is my models: @RealmClass public class UserRealm extends RealmObject implements Serializable { private String email; private String password; private String tokenId; private String tokenSecret;...

List Or RealmList on Realm Android java,android,realm
I need a list<Object> using Realm. I tried RealmList<RealmObject> but it doesn't work because RealmObject is abstract.

How to make RLMResults mutable?

ios,iphone,realm
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?...

How to make a nested query in Realm?

realm
I have two realms: public class ChatRealm extends RealmObject { private String id; private RealmList<UserRealm> users; } public class UserRealm extends RealmObject { private String id; private String username; } I have an User id and I want to know which chats he is participating in. I have check the...

Encryption in Realm gives java.lang.IllegalStateException: Wrong key used to decrypt Realm

android,encryption,realm
I am using Encryption in Realm for inserting data into database. I have to insert data into different tables, and tried to encrypt the data in tables. But i just got java.lang.IllegalStateException: Wrong key used to decrypt Realm. My Codes: DatabaseHandlerRealm.java public class DatabaseHandlerRealm { private Realm realm; byte[] key,...

Realm.io Removing the realm file

ios,file,realm
My question, how can I properly remove a realm file? Currently I'm doing so using the file manager, which is fine for me since the Realm file is mostly here for offline caching. My app logs in to a web-platform, and creates a realm for this platform so you can...

Using Reflection with Realm (Android)

java,android,reflection,realm
I made a switch to Realm last week. Now, I've got this issue when using reflection: Normally I'd use reflection to fetch field, which when available I'd use to replace url params in our API url f/e: blog/{blogId}/comments <- not an actual url but an example. The code would check...

Getting child RLMObjects from transformer using ObjectMapper

swift,realm,object-object-mapping
I'm using both ObjectMapper (https://github.com/Hearst-DD/ObjectMapper) and Realm in my project. My Objects are all RLMObjects; I have for example a Blog Object which contains attachments: dynamic var attachments = RLMArray(objectClassName: Attachment.className()) I have a custom transformer which starts like this: func transformFromJSON(value: AnyObject?) -> RLMArray? { let attachments = RLMArray(objectClassName:...

Realm - Share Database between Apps

java,android,database,realm
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...

Realm blocks Gson library

android,database,parsing,gson,realm
I have an issue with the Realm library. I implemented it in my app, included the library. Started creating some realmObjects, in order to use with my app, and then I tried starting the app, but to my surprise, it got stuck on the first page, which is strange, cause...

Error when using Realm with Xcode 6.3.1

swift,cocoapods,realm
Today i decided to give a go to Realm for a project, but, when adding it via cococa pods, it just keeps yelling me he can't find Realm.Private on the ListBase class. tried to clean, tried to reimport, closed & reopened Xcode.... content of my cocoapods file: source 'https://github.com/CocoaPods/Specs.git' platform...

Realm - Can't set object of type subclass to property of type parent class

realm
Hi everyone, I encounter a little problem with Realm, I have a class "Contact" and a subclass "Person" defined as : Person.h #import <Realm/Realm.h> #import "Contact.h" RLM_ARRAY_TYPE(Person) @interface Person : Contact @property NSString * nickName; @end I have an other entity called "Address" which has a "Contact" property ( an...

How to reproduce MATCHES in NSPredicate to query Realm?

regex,nspredicate,realm
I have a query using NSPredicate that takes regular expression and matches to paths: let predicate = NSPredicate(format: "path MATCHES '/test/([^/]*[^/])$'") which matches everything inside folder test but excludes all subfolders of folders in test, like this: /test/abc -> yes /test/abc/def -> no The problem is, that I can't use...

How to migrate Realm object that hasn't been stored?

ios,swift,migration,realm
I have an object that I haven't stored anywhere (yet). Even without creating a Realm for it, the app crashes saying this object requires a migration after I've modified it. I've tried this (in method func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool): RLMRealm.setSchemaVersion(1, forRealmAtPath: RLMRealm.defaultRealmPath()) { (migration: RLMMigration!,...

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

ios,xcode,frameworks,realm
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...

Android Realm Migration version number based on what?

android,realm,realm-migration
I'm doing my first Realm migration and started thinking about the version number. On what is this version number based? Because if it is based on what is on your phone, how do I handle it if a new person installs the app and gets a migration? Because it will...

Realm.io Query with GroupBy

java,android,sql,orm,realm
I want to group some accounts by month, can i do this with Realm.io? public class Account extends RealmObject { ..... private Date date; } RealmResults accounts = realm.where(Account.class) .beginGroup() .equalTo("date", "MONTH(date)")//<----- wrong code .endGroup() .findAll(); thanks...

Realm: How to add two Results<(Object)> in Realm

ios,swift,realm
For arrays we could just do resultArray = array1 + array2 I have two results of Results<(Object)> how do I add them? Do I have to loop or is there in any other way?...

Equivalent “completion handler” from MagicalRecord to Realm.io

ios,block,magicalrecord,realm,completion
I searched for a many days, but I can not find it. What would be the equivalent of the following MagicalRecord statement in Realm.io? [MagicalRecord saveUsingCurrentThreadContextWithBlock:^(NSManagedObjectContext *localContext) { // Save block } completion:^(BOOL success, NSError *error) { // Completion block }]; I need "Save block", and when it finish, execute...

realmDb initialization error

android,realm
I heard about RealmDb which is a convinient database that can replace sqlite on android platform. im trying to get it working on my galaxy s2 android version 2.3 i use realm version 0.79.1 however i get the following massage: 03-06 12:26:24.820: E/AndroidRuntime(17507): FATAL EXCEPTION: main 03-06 12:26:24.820: E/AndroidRuntime(17507): java.lang.ExceptionInInitializerError...

iOS Realm Update Object In Block

ios,objective-c,grand-central-dispatch,realm
I'm working on integrating Realm into an iOS app, and am beginning to write a class to handle all of my Realm stuff and was writing a convenience method to update any RLMObject dynamically. In their docs, updating an object is as simple as: - (void)someMethod { [self.realm beginWriteTransaction]; someObject.name...

Realm.io offline, Parse online - What about users

android,parse.com,realm
I'm using Parse for the first time to play around with. I use Realm.io as a offline db. Both are very powerful and it's great to get to know them better. (Big up to both teams!) My app should be able to be used on remote locations, where you can't...

Correct way to retrieve a single object from Realm database

database,swift,realm
I am absolutely loving Realm (0.92) in combination with Swift but have a question about reading an object from the database. My goal is to retrieve a single object with a known, unique ID (which also happens to be the primary key. All the documentation appears to be oriented around...

Update Realm Object Android

android,realm
I have VisitingCardPOJO form table I want update single entry say where no=3 VisitingCardPOJO .java public class VisitingCardPOJO extends RealmObject { @PrimaryKey private int no; private String name; private String address; public int getNo() { return no; } public void setNo(int no) { this.no = no; } public String getName()...

Adding items to Realm database changes some variables

android,database,list,realm,realm-list
This is the code I have: for (SearchData searchData1 : searchDataTemp){ Log.i("", "test is favourite searchdata:" + searchData1.getIs_favorite() + "..name: " + searchData1.getTitle()); } Realm realm = Realm.getInstance(getActivity()); realm.beginTransaction(); List<SearchData> managedSeachData = realm.copyToRealmOrUpdate(searchDataTemp); realm.commitTransaction(); for (SearchData searchData1 : managedSeachData) { Log.i("", "test is favourite searchdata:" + searchData1.getIs_favorite() + "..name: "...

What's the most efficient way to store time zone info in Realm?

ios,osx,nsdate,realm,foundation
I have a Realm object that contains an NSDate timestamp, representing the time at which a user recorded something. I need to add time zone info to this, so that I know what the local time zone was when the user created the object (in order to do accurate date...

Is it possible to serialise a Realm Object into JSON?

ios,json,swift,realm
Does anyone know if there's any support in Realm (iOS) to be able to serialise an RLMObject into JSON for export?

Limit Realm results

android,realm
How do I limit the amount of objects Realm returns? .findAll returns all rows matching the query and .findFirst returns only the first. But what about something like first 1000? .findAll may return so many rows that it consumes way too much memory.

Retrofit and Realm access from another thread in Android

android,multithreading,retrofit,realm
I am using Realm for database service and Retrofit for server service. I want to get data from Realm and pass it as object to Retrofit, but I get following error : retrofit.RetrofitError: Realm access from incorrect thread. Realm objects can only be accessed on the thread they where created....

How to convert RealmResults object to RealmList?

android,realm
I have a RealmResults <Student> object. I want to convert it to RealmList <Student> object. any suggestions?