realm

Realm Swift: Is it possible to keep database after the apps is uninstalled?

前提是你 提交于 2019-12-01 15:57:53
问题 Using realm swift, is it possible to keep and maintain the realm database file of the apps in device memory even after the apps is uninstalled from the device? Thank you very much for any help. 回答1: Applications all files are leftover when deleting an app. iOS apps are Sandboxed. This means that each App has its own space in disk, with its own directories, which act as the home for the app and its data. Deleting an app from the iPhone deletes this sandbox, deleting all data associated with

Android - Realm - Object delete - Object is no longer valid to operate on

谁说胖子不能爱 提交于 2019-12-01 15:49:18
I'm trying to delete an item from a RecyclerView populated from a Realm Database and I'm getting the following error: java.lang.IllegalStateException: Illegal State: Object is no longer valid to operate on. Was it deleted by another thread? Assumptions I guess that I'm trying the access when it's already deleted, but I don't understand where. Context: I'm showing a list of cities and longClicking on an item shows a dialog asking to confirm the deletion. The item is deleted in the database since when I relaunch the app, it's not there anymore. Realm to ArrayList public static ArrayList<City>

Realm Subquery to filter data from 1 table w.r.t table 2

守給你的承諾、 提交于 2019-12-01 13:56:55
Suppose that I have two models and corresponding tables in the Realm Database public class Customer :Object { dynamic var Id : String = "" dynamic var NAME : String = "" dynamic var Address : String = "" override public class func primaryKey() -> String? { return "Id" } } public class Bills :Object { dynamic var Id : String = "" dynamic var Amount : String = "" dynamic var CustomerId : String = "" override public class func primaryKey() -> String? { return "Id" } } What I am doing: I am getting list of All customers easily by doing this realmObj.objects(Customer.self) What I want: I want to do

Swift Realm: After writing transaction reference set to nil

删除回忆录丶 提交于 2019-12-01 13:43:54
I have the following code class Family: Object { dynamic var name = "" var members = List<FamilyMember>() } class FamilyMember: Object { dynamic var name = "" dynamic var belongsToFamily: Family? } let realm = try! Realm() let familyMember = FamilyMember() familyMember.name = "NameExample" let newFamily = Family() newFamily.name = "Familyname" try! realm.write { newFamily.members.append(familyMember) familyMember.belongsToFamily = newFamily realm.add(newFamily) realm.add(familyMember) } QUESTION: Why is familyMember.belongsToFamily set to nil after Realm's writing transaction? It's intended

How to get data from **Realm database** using **date object**?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 13:19:01
I have tried some realm queries but not getting that result which I want let's consider below table for example(Realm table): id Name DateTimeStamp 1 A 2017-01-01 08:00:00 2 B 2017-01-01 15:00:00 3 C 2017-01-02 08:00:00 Now I want all those records which match the date "2017-01-01".so for this case I should get 2 records from realm table.Right now I am not getting any record. For information "DateTimeStamp" column datatype is "Date".and yes I need to store date and time both in the database as you can see on the table. Query i have tried is: long cnt = realm.where(ReservationObject.class)

Realm Subquery to filter data from 1 table w.r.t table 2

两盒软妹~` 提交于 2019-12-01 13:01:16
问题 Suppose that I have two models and corresponding tables in the Realm Database public class Customer :Object { dynamic var Id : String = "" dynamic var NAME : String = "" dynamic var Address : String = "" override public class func primaryKey() -> String? { return "Id" } } public class Bills :Object { dynamic var Id : String = "" dynamic var Amount : String = "" dynamic var CustomerId : String = "" override public class func primaryKey() -> String? { return "Id" } } What I am doing: I am

Realm's Swift module compiled with Swift 3.0 cannot be imported in Swift 3.0.1

半腔热情 提交于 2019-12-01 12:50:57
I just started using Realm 2.0.4 yesterday with Xcode 8 and it worked fine. Today I updated to Xcode 8.1 and it no longer will compile. I get an error saying "Module compiled with Swift 3.0 cannot be imported in Swift 3.0.1." How can I fix this? I have deleted Realm.framework and RealmSwift.framework from the embedded framework table and dropped in the 3.0.1 version, but the issue persists. I have deleted the DerivedData folder and it didn't work. What do I do? I am not using CocoaPods or Carthage. Just for future reference, a bunch of things that you can try: Clean the build folder (Go to the

How to Show Preload data to RecyclerView using Realm

爷,独闯天下 提交于 2019-12-01 12:01:36
In my App I am using Realm as local database. I am using recyclerview widget to show these data. Now initiallay I want to show some preload data in recycler view which would be stored in realm as well. then I will implement add, edit, delete method. But I am having fatal error while trying to run this app. I am very new in Realm. I cannot identify which problem is this. I have Solved this problem with the help of answer code. here is the solution for this. Solved Code And My Activity Class is public class MyColleaguesPage extends AppCompatActivity { private RecyclerView recyclerView; private

Android Kotlin Realm Proper Way of Query+ Return Unmanaged Items on Bg Thread

梦想的初衷 提交于 2019-12-01 11:57:10
What is the proper way of querying and returning an unmanaged result of items with realm, everything in the background thread?. I'm using somethibf like this: return Observable.just(1) .subscribeOn(Schedulers.io()) .map { val realm = Realm.getDefaultInstance() val results = realm.where(ItemRealm::class.java) .equalTo("sent", false).findAll() realm to results } .map { val (realm, results) = it val unManagedResults = realm.copyFromRealm(results) realm.close() unManagedResults } } And then chaining this observable with another one that will post the results to a server. The solution working,

How to get data from **Realm database** using **date object**?

依然范特西╮ 提交于 2019-12-01 11:44:56
问题 I have tried some realm queries but not getting that result which I want let's consider below table for example(Realm table): id Name DateTimeStamp 1 A 2017-01-01 08:00:00 2 B 2017-01-01 15:00:00 3 C 2017-01-02 08:00:00 Now I want all those records which match the date "2017-01-01".so for this case I should get 2 records from realm table.Right now I am not getting any record. For information "DateTimeStamp" column datatype is "Date".and yes I need to store date and time both in the database