realm

How can I do safe delete using Realm

孤者浪人 提交于 2019-12-13 09:51:46
问题 Some times app crashes saying object has been deleted. Please let me know how can I delete with catch exception. 回答1: you have to check for the object if it is invalidated or not if !myObject.isInvalidated { //the object exists and it is safe to handle it } 来源: https://stackoverflow.com/questions/46291463/how-can-i-do-safe-delete-using-realm

What would be a good way to handle “snoozed” functions?

房东的猫 提交于 2019-12-13 09:48:09
问题 I've tried a few solutions so far but I'm not sure if there is a "right" way. I'm working on a todo list with a snooze function. Each task has a "wake from snooze" time when I need to run a function to move it into a different list. I've tried looping through each task and moving it when viewWillAppear and/or viewDidAppear runs. This generally works but seems to misfire occasionally and wouldn't happen while the app is running and the user isn't switching views. I've tried using the Timer()

Saving a Linked object to Realm Database in swift

大憨熊 提交于 2019-12-13 09:35:31
问题 I am trying to create a list item in a category after selecting the category but I when ever I click on the save button, nothing happens and the values dont get saved in the realm database. Below is my code which is not working func createTodoList(name: String, description: String, createdDate: Date, remiderDate: Date, isCompleted: Bool) -> Void { let item = TodoListVC() if let currentCategory = item.selectedCategory { do { try self.database.write { let todoList = TodoListModel() todoList

Store string type array in RealM objective c

家住魔仙堡 提交于 2019-12-13 09:22:56
问题 i want to store string type of array in Realm objective c . Ex array :- ["58575bc922e87bd14480132f","58575c5c22e87bd144801331","58575cc922e87bd144801333","58575d5b22e87bd144801335","58575bc922e87bd14480132f","58575c5c22e87bd144801331","58575cc922e87bd144801333","58575d5b22e87bd144801335","58575bc922e87bd14480132f","58575c5c22e87bd144801331","58575cc922e87bd144801333","58575d5b22e87bd144801335"] 回答1: You can inherit from RLMObject class and put the NSString into your RLMObject as a property.

Accessing Realm from an iOS Extension while using Realm Mobile Platform

。_饼干妹妹 提交于 2019-12-13 08:39:59
问题 I would like to access my Realm from an iOS extension however the realm path is unavailable when using the Realm Mobile Platform. I've received advice from realm to hold a cloned copy and keep it in sync. How can that be achieved? ...and is it considered a "clean" solution? (there could be multiple realms) 回答1: You should just open the synced Realm from your extension by creating a Realm configuration with a proper sync configuration (specifying user and remote Realm URL), like usual. This is

How to get Realm from the server?

試著忘記壹切 提交于 2019-12-13 08:11:53
问题 Is it impossible to get Realm from the server? I tried this, but it doesn't work. var url = "http://address/default.realm" var rlm = RLMRealm(path: url) Error message says 'No such file or directory' . 回答1: What you're trying isn't supported in this way. If you want to use a Realm on the server side to seed your database, you would need to download it first and save it to the local filesystem of the device to load it from there. If you want to sync data between the device and your server or

Size of storage on Realm Object Server

不羁岁月 提交于 2019-12-13 07:21:36
问题 I have iOS project integrated with RMP, so how I can get size of storage from Realm Object Server? 回答1: It is currently not possible to query the server for the size usage of a specific Realm file. This is an API that will (most probably) come at a later date. As a reminder, the Realm Object Server needs to keep the entirety of the history, in order to allow old joiners to merge and get updated to the latest version. 来源: https://stackoverflow.com/questions/40232169/size-of-storage-on-realm

Realm file size is too large

拥有回忆 提交于 2019-12-13 07:17:51
问题 I'm trying to integrate Realm into my project and noticed an issue. I've seen other posts on this, but they were a little over a year ago and have been resolved.. When adding objects to Realm, things are file. But when removing objects, they get removed from the DB, but the file size is still large. If I open the realm file in TextEdit, I can see raw text of old records. Why aren't they getting fully deleted? Take a look at this screenshot. Zero files in the Realm DB, but the file size is 23

Can't delete Realm database objects from another thread (even after searching)

巧了我就是萌 提交于 2019-12-13 05:05:44
问题 I'm having a similar problem as the poster in this thread: Unable to delete an object in a realm database I have an array of RLMObject subclasses created from a search on a queue called 'syncQueue'. It's a bunch of Diagnostic objects that need to be sent up to the server. These objects are packaged up and sent up to the server using the Google Client Library for iOS. Once the library returns that the objects have been successfully uploaded, I want to delete them out of Realm. I grab some

Realm access from incorrect thread in rx and dagger

早过忘川 提交于 2019-12-13 04:46:04
问题 I know this question asks a lot but i am confused by reading this question.In my project i am using dagger, rx and realm in mvp pattern.I have an application with a LoginActivity that when the user login correctly, the user information that comes from server store in realm in this page and user jumps to MainActivity.In MainActivity i want this user info but i got this error: java.lang.IllegalStateException: Realm access from incorrect thread. Realm objects can only be accessed on the thread