realm

Implements Serializable on RealmObject 0.88

淺唱寂寞╮ 提交于 2019-12-12 02:59:12
问题 I've been to see the new updates of the Realm 0.88 and I found this interesting: Implement interfaces. Well, I try implement an interface (Serializable) without success. when I put a object on the intent I get this error: java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.test.realmtest.network.search.response.Hotel)" I'm doing something wrong? 回答1: Even though RealmObjects support interfaces, they are not parcelable. At least not yet. There

Delete a Realm model with Swift

谁说胖子不能爱 提交于 2019-12-12 02:25:08
问题 I need to remove old, empty models from a Realm Cocoa database. There seems to be a way to do it in Java, but not in Swift. Is that correct? If you remove a property and initiate a migration Realm will remove the corresponding column in the table: class Dog: Object { dynamic var name = "" // dynamic var age = 0 } But, if you remove the model definition entirely, the migration does not remove the table: // class Dog: Object { // dynamic var name = "" // dynamic var age = 0 // } Here's a

Installing Realm with Create React Native App

大城市里の小女人 提交于 2019-12-12 02:22:45
问题 While I'm trying to install Realm, I'm asked to edit some of the generated .java files for Android: https://realm.io/docs/javascript/latest/#getting-help However, Create React Native App hides the system level code from the user. Does that mean using CRNA is impossible, and I have to switch to straight React Native? 回答1: create-react-native-app has its own build scripts that depend on the platform specific code to be modified by Expo. The whole idea of create-react-native-app is to stick to

RealmChangeListener does not execute when added shortly after asynchronous write

两盒软妹~` 提交于 2019-12-12 01:26:14
问题 Long story short: I do not know why my RealmChangeListener does not trigger as intended under certain circumstances and am looking for advice on why a RealmChangeListener could not be working. Update: I have verified that the RealmResults stay valid = true; loaded=false. If I execute RealmResults.load() after adding the change listener, it will output a vague Throwing Exception 7 in the log and a BadVersionException when I step through the Realm source. I think this exception makes some sense

Problems organizing complex json response with Realm

时光毁灭记忆、已成空白 提交于 2019-12-11 23:45:27
问题 I am trying to use realm with my android application. I tried looking in to some simple examples about realm. I was able to setup the project with realm and now want to start implementing it but facing problems to generate classed in accordance to my json response. following is an example of json I will be using { "Status":true, "Message":"Success", "ds":{ "Table1":[{ "CustomerId":"1", "CustomerName":"TestUser", "CustomerNo":"100001", "CustomerUrl":"http://abc-001-site10.itempurl.com",

Realm 0.88.2 example : Cannot resolve symbol

被刻印的时光 ゝ 提交于 2019-12-11 23:26:45
问题 I downloaded this : https://static.realm.io/downloads/java/realm-java-0.88.2.zip Then imported the "examples" folder inside Android Studio. I can run examples but Android Studio cannot resolve symbols for Realm classes. Is there something missing in this example project ? I want to enable completion. Edit : When I add "compile 'io.realm:realm-android:0.87.5'" to the build.gradle, this error occur : [...] :introExample:generateDebugSources UP-TO-DATE :introExample:compileDebugJavaWithJavac

Using RealmSwift to save an one-to-many relationship object

橙三吉。 提交于 2019-12-11 19:28:15
问题 I'm coming from a Ruby on Rails-like data structure in terms of relationships. So in Rails: Foo has many Bars and Bar has one Foo. Going through the RealmSwift docs, I came up with this, I think: class Foo: Object { // other props var bars = List<Bar>() // I hope this is correct } class Bar: Object { // other props @objc dynamic var foo: Foo? } If the above is corrct, I struggle to know how to create this relationship object. // I need to create Foo before any Bar/s var foo = Foo() foo

updating an array of items in realm swift

杀马特。学长 韩版系。学妹 提交于 2019-12-11 19:20:12
问题 I am trying to update the content of a real database which takes an array. I would like to update the array stored in it below is my code for it class TodoListModel: Object { @objc dynamic var id = UUID().uuidString let photos = List<Data>() @objc dynamic var createdDate: Date? override static func primaryKey() -> String? { return "id" } let parentCategory = LinkingObjects(fromType: CategoryModel.self, property: "items") } In this case, the new Data just gets added instead on replacing the

How to get the realm information from an second activity?

﹥>﹥吖頭↗ 提交于 2019-12-11 18:08:42
问题 I got the schoolID from the main activity, which is base on realm from a json file. Using the school ID I am trying to get the students name. My question is how to get the students name and how to list the students from the student adapter. Thanks. The following is the student activity: @Override public void onResume() { super.onResume(); Bundle extras = getIntent().getExtras(); if (extras != null) { String schoolName = extras.getString("schoolName"); RealmResults<School> schools = realm

Issue with Realm Unit Test on Android

爱⌒轻易说出口 提交于 2019-12-11 18:07:29
问题 Using the JUnit4 Test Runner, the test runs and seems to work, but the query returns no results: @RunWith(AndroidJUnit4::class) class LocationViewInstrumentationTest { @Rule public val mActivityRule: ActivityTestRule<MapsActivity> = ActivityTestRule(MapsActivity::class.java) @Rule var testFolder = TemporaryFolder() @Test fun mapViewIsRendered() { onView(withId(R.id.map)).check(matches(isDisplayed())) } @Test @Throws(IOException::class) fun canSaveLocation() { val tempFolder = testFolder