realm

How to handle null value in realm.io?

感情迁移 提交于 2019-12-10 20:34:17
问题 from what I see if the value is nil for a property it always throws exception. sometimes i cannot simply set a '' empty string as nil, so what's the solution in realm? thanks. 回答1: Null is now fully supported. OLD answer: Supporting nil/NULL is on the roadmap. Until then there are two workarounds: Add a separate property to indicate if your property is nil. @interface IntObject : RLMObject @property NSInteger myProp; @property boolean myPropIsNil; @end Wrap your property in an object: Object

iOS Swift Realm Sync Issue

折月煮酒 提交于 2019-12-10 19:33:00
问题 I used this configuration code for local storage. var configuration = Realm.Configuration.defaultConfiguration configuration.encryptionKey = getKey() as Data I used this configuration code for sync with server. let syncServerURL = URL(string: serverUrl + objectName!)! var configuration = Realm.Configuration.defaultConfiguration configuration.encryptionKey = getKey() as Data configuration.syncConfiguration = SyncConfiguration(user: SyncUser.current!, realmURL: syncServerURL) I create some data

Linked objects' properties in Realm React-Native ListView return undefined (error: undefined is not an object)

本秂侑毒 提交于 2019-12-10 19:01:20
问题 I'm trying to access the properties of a linked object through the parent object, but I only get back undefined. This is code within the renderRow method/prop of ListView (I am using the Realm ListView). On android, haven't tested iOS. Getting the linked object itself seems to work fine. Heres some (trimmed) code context: // Schemas being used to create realm (trimmed down to relevant) class Item {}; Item.schema = { name: 'Item', primaryKey: 'id', properties: { id: 'string', name: 'string',

Filter realm objects based on counting list<t>

你离开我真会死。 提交于 2019-12-10 17:54:42
问题 I'm trying to query a class based on the number of match objects. However, I keep getting following error 'Unable to parse the format string "matches.@count > 0"' . I've tried following code from the documentation, but it does not help. What I want is to get all leagues, which has more than 0 matches? Class class League:Object { dynamic var id: Int = 0 dynamic var name: String? = "" var matches = List<Match>() override class func primaryKey() -> String { return "id" } } class Match:Object {

Realm file could not be opened

无人久伴 提交于 2019-12-10 17:54:26
问题 When I use realm for Android 0.82.2 I can open default.realm file in Realm Browser 0.95.2 (9). But when I use realm 0.83.0 and try to open default.ream in Browser I get an error: 'default' could not be opened. It may be encrypted, or it isn't in a compatible file format. I don't use encryption. Realm browser installed from App Store. 回答1: Realm Java 0.83 brings a breaking change to the file format. This wasn't adopted yet by the browser. But there is a branch with still experimental support

Filtering query in Realm by NSDate throws NSInvalidArgumentException

孤街醉人 提交于 2019-12-10 17:21:28
问题 I've looked everywhere, even hitting some dubious sites with virus warning messages that never goes away, and I can't figure this out. I'm simply trying to filter Results<T> object by date: let messages = realm.objects(RMChatMessage).filter("timestamp > \(date)) AND (timestamp <= \(to))")) And whenever this line is run, it raises the following: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Unable to parse the format string "timestamp > 1970-01-01 00:00

Filtering Realm object in android

萝らか妹 提交于 2019-12-10 17:16:16
问题 So i've started to use Realm and everything works fine, well almost everything. I'm using a MultiAutoCompleteTextView to select some user (RealmObject) so here goes: this is my Filter( inner class of my adapter) private class UserFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { FilterResults filterResults = new FilterResults(); if (constraint == null || constraint.length() == 0) { filterResults.values = mUsers; filterResults.count = mUsers

Store concrete generic subclass in Realm

邮差的信 提交于 2019-12-10 16:18:13
问题 Is it possible to store a concrete generic subclass in Realm? For example: class MyClass<T> : Object{} class ConcreteMyClass : MyClass<String> {} I know that it is not possible to store MyClass in Realm. However, is it somehow possible to store the ConcreteMyClass ? 回答1: Yes, it's possible to use concrete generic subclasses for Realm models, you just need to tell Realm to ignore the non-specialized classes: import Cocoa import RealmSwift class MyClass<T>: Object { dynamic var parentProp = 0

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

被刻印的时光 ゝ 提交于 2019-12-10 15:45:48
问题 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 this? 回答1: You'll have to wait for us to support Swift 2.0 (#2062) before you can use Realm Swift in your Swift 2.0 project. Because the framework written in Swift which was built in the old version compiler is not able

Realm Find Queries Result in Empty Objects [duplicate]

[亡魂溺海] 提交于 2019-12-10 14:28:10
问题 This question already has answers here : Cannot retrieve field values from realm object, values are null in debugger (3 answers) Closed 2 years ago . When doing find queries for objects I'm getting "empty" objects (non-null, but not populated). However, in the debugger I can see the data for the object in the object description (see below). I've also verified the data is there using the Realm Browser. I've tried different find queries, querying with filter criteria, using the same Realm