天道酬勤,学无止境

realm

Unrecoverable error. mremap(): failed: Out of memory in io_realm_internal_SharedGroup.cpp line 188

I have implemented Realm as my DB, and in my app I run a service on the phone contacts for checking any change in my phonebook. The service works for like 3 to 4 changes and then the app crashes with this error in my logcat. Unrecoverable error. mremap(): failed: Out of memory in io_realm_internal_SharedGroup.cpp line 188 Here's my code: public static void refreshingContactsDB() { createCountryDetailsArrayModel(); TelephonyManager tm = (TelephonyManager) ApplicationController.getInstance() .getSystemService(Context.TELEPHONY_SERVICE); String simCountryISO = tm.getSimCountryIso(); for (int i =

2022-01-19 02:35:08    分类:问答    android   realm

How to cancel Work from WorkManager in Android?

I have saved the WorkManager UUID converted to String in Realm database. Here is the code - Constraints constraints = new Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED).build(); Data inputData = new Data.Builder().putString("downloadUrl", downloadUrl). putString("destinationFolder", destinationFolder). putInt("suraNumber", Integer.parseInt(suraNumber)). putString("fileName", fileName). putBoolean("downloadFileTypeBangla", downloadFileTypeBangla). putBoolean("downloadFileTypeArabic", downloadFileTypeArabic). putBoolean("downloadFileTypeArabicWithBangla"

2022-01-18 23:18:26    分类:问答    android   realm   android-workmanager

Realm Swift callback function

I use swift3 and Realm 2.3. And I need callback after transaction is finished. for example, I have a code as below, how can I get call back after a realm data transaction is finished ? DispatchQueue.main.async { try! self.realm.write { self.realm.add(friendInfo, update: true) } }

2022-01-18 12:59:54    分类:问答    swift3   realm   realm-mobile-platform

Implementing ignoredProperties() on both a Object subclass and its own subclass

I'm new to Realm. I'm creating my models with a base class that inherits from Object, and custom subclasses of this base class. My model requires that the base class declares some properties as ignored by overriding the static ignoredProperties() method. When trying to override that method on some of the base class subclasses, I get a Swift compiler error stating that Class method overrides a 'final' class method. I don't have my base class implementation marked as final. I don't know if this is a current limitation with Realm but I can't seem to find any references to this issue. My code

2022-01-18 07:16:35    分类:问答    swift   realm

CocoaPods and Realm in Swift

Using Xcode-6.3.1, iOS-8.3 and MacOS-10.10.3, I am trying to use RealmSwift (0.92.3) and CocoaPods 0.37.1 I use the following procedure : install cocoapods (in terminal): $ sudo gem install cocoapods Create new Xcode project (named MyApp) Create Podfile platform :ios, '8.3' use_frameworks! target 'MyApp' do pod 'RealmSwift', '>= 0.92.3' end target 'MyAppTests' do pod 'RealmSwift', '>= 0.92.3' end Place the Podfile in the MyApp folder (next to MyApp.xcodeproj) Download the newest Realm (0.92.3 from here) (i.e. Swift version) unzip it go to /ios folder copy RealmSwift.framework also to your

2022-01-17 22:53:22    分类:问答    ios   swift   cocoapods   realm

Realm Error: Property requires a protocol defining the contained type

I have the following model and I'm using Realm: @interface GUIRoutineModel : GUIModel # GUIModel is a subclass of RLMObject @property (nonatomic, retain) NSString *dateCreated; @property (nonatomic, retain) NSString *dateModified; @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *type; @property NSInteger userId; @property int routineId; #also have same issue using NSInteger @end When I call: // Persist to Realm DB RLMRealm *realm = [RLMRealm defaultRealm]; [realm transactionWithBlock:^{ [realm addObject:routineModel]; }]; I get the following error:

2022-01-17 21:55:42    分类:问答    ios   objective-c   realm

Use React Native Realm to Query through multiple List Objects

First day using React Native and Realm, and I'm having a hard time figuring how to perform a query through two Realm List Objects. Tasks have Reservations, which have Renters, which have first_name and last_name fields. I want my users to be able to search for tasks by the Renter's first and last names. Essentially, "Give me all the tasks whose renter's first or last name begins with "xyz"" const TaskSchema = { name:'Task', properties: { reservations:{ type: LIST, objectType: ReservationSchema.name }, } }, const ReservationSchema = { name:'Reservation', properties: { renters:{ type: LIST

2022-01-17 18:07:14    分类:问答    android   react-native   realm   realm-list

Realm React Native - Migration is required: Target type 'string' doesn't exist for property 'emailAddresses'

I am building a small app with React Native and want to use Realm for persistency. I defined the following schema for a Person: const personSchema = { name: 'Person', properties: { familyName: {type: 'string', optional: true}, givenName: {type: 'string'}, middleName: {type: 'string', optional: true}, emailAddresses: {type: 'list', objectType: 'string'}, } } export class Person {} Person.schema = personSchema The information as to how a Realm schema needs to be defined can be found in the Realm docs. I then instantiate the DB like so: const schemas = [Person] const db = new Realm({schema

2022-01-17 17:51:14    分类:问答    javascript   react-native   realm

How to unit test Realm migrations?

Im trying to unit test a migration on Realm. My main question is: how can I maintain different schema versions of a RealmObject so as to be able to create a an instance of the old object, do the migration and then check if it is correct according the new schema version? I started by trying to keep the different schema versions but it wont compile since the objects have the same name, despite being on different packages.

2022-01-17 15:52:07    分类:问答    android   realm

如何使 RLMResults 可变?(How to make RLMResults mutable?)

问题 Realm 文档说RLMResults是 lick NSArray 。 我从数据库返回了一些结果,我想将它合并到另一个RLMResults中。 但它似乎是不可变的,如何让RLMResults添加来自另一个RLMResults的对象? 或使其可变? 或将其转换为NSArray ? 回答1 目前这是您必须手动执行的操作。 您可以通过连接两个结果来创建 RLMArray。 不过,我们正在进一步讨论相同类型 RLMObjects 的路线图上的联合/合并方法。 您可以分享的任何内容都将帮助我们了解用例并可能影响 api 设计 只要它们是相同的类型,这是一个通用示例 let currentTask = Task.objectsWhere("name = %@", "First task").firstObject() as Task let currentRecords = currentTask.records let arrayOfRecords = RLMArray(objectClassName: "Record") arrayOfRecords.addObjects(currentRecords) let futureTask = Task.objectsWhere("name = %@", "Future task").firstObject() as Task let

2022-01-16 15:01:00    分类:技术分享    ios   iphone   realm