realm

Passing Realm objects between ViewControllers

别来无恙 提交于 2019-12-25 04:28:08
问题 How would you go about passing Realm objects between controllers? Would you pass just the ID and then fetch the object in the new controller or just pass the whole Realm object? 回答1: The current best practice is to just fetch again. If you are working off of a background thread, you can pass primary keys to the main thread and fetch with those. It's not that big of a performance issue in the thousand of objects due to how realm handles the loading of objects 回答2: As far as I can see, the best

Use Vuforia and io.realm db crash the app

吃可爱长大的小学妹 提交于 2019-12-25 04:27:50
问题 I am having trouble using the SDK-Vuforia 5.0.5 with io.realm data pack. When attempting to boot the Vuforia the app this closing and displays the following error in the line of LogCat: W/System.err﹕ The library libVuforia.so could not be loaded By removing the following line in gradle the application runs smoothly: compile 'io.realm:realm-android:0.82.2+' 回答1: You cannot mix 32-bit and 64-bit libraries which is what is happening here. The proper solution would be to ask Vuforia to provide 64

Shiro权限管理框架

北慕城南 提交于 2019-12-25 03:14:18
一、Shiro介绍   Apache Shiro 是Java 的一个安全框架。Shiro 可以非常容易的开发出足够好的应用,其不仅可以用在JavaSE 环境,也可以用在JavaEE 环境。Shiro 可以帮助我们完成:认证、授权、加密、会话管理、与Web 集成、缓存等。   既然shiro将安全认证相关的功能抽取出来组成一个框架,使用shiro就可以非常快速的完成认证、授权等功能的开发,降低系统成本。 shiro使用广泛,shiro可以运行在web应用,非web应用,集群分布式应用中越来越多的用户开始使用shiro。 java领域中spring security(原名Acegi)也是一个开源的权限管理框架,但是spring security依赖spring运行,而shiro就相对独立,最主要是因为shiro使用简单、灵活,所以现在越来越多的用户选择shiro。 二、Shiro基本概念    Shiro 不会去维护用户、维护权限;这些需要我们自己去设计/提供;然后通过相应的接口注入给Shiro即可 1,Authentication   身份认证/登录,验证用户是不是拥有相应的身份。 2,Authorization   授权,即权限验证,验证某个已认证的用户是否拥有某个权限;即判断用户是否能做事情,常见的如:验证某个用户是否拥有某个角色

Realm object update fails on write

霸气de小男生 提交于 2019-12-25 02:44:12
问题 I am trying to update a realm object everytime there is a value change in firebase. It just like whenever there's a change of object in the server it should automatically trigger a new write and update an obejct with primary key uid . Here is a question I posted couple days ago. It gave me a momentary solution which worked for the moment but then following error started to pop up. For the first run, everything ran fine and updated the object. But, as soon as I re-ran the program, It created a

RxJava group two responses one of which might be NULL with zip operator

北慕城南 提交于 2019-12-25 02:33:00
问题 I want to make two concurent request to Realm database and return results with RxJava. The issue is that one of requests can return NULL object and I have a crash. How can I properly return results from both DB even if one of them NULL? Thanks. public void getDataFromTwoSources(DisposableObserver<ComplexUserDto> observer, String shopId) { Preconditions.checkNotNull(observer); final Observable<ComplexUserDto> observable = Observable.zip(firstRepository.getUserData(userId), secondRepository

How to make RealmList<String> Parcelable?

我们两清 提交于 2019-12-25 02:27:12
问题 @Parcelize open class TestClass( @SerialName("title") var title: String, @SerialName("list") var list: RealmList<String> ) : RealmObject() { ... } How can I parcelize "list" variable in this implementation? It says, that it's not possible to parcel this type of value even if I add @RawValue . What's the alternative here? An example with explanation would be flawless. 回答1: Similarly to this approach, you can do fun Parcel.readStringRealmList(): RealmList<String>? = when { readInt() > 0 ->

Realm java nested query on same ArrayObject

假如想象 提交于 2019-12-25 01:49:12
问题 Current code: mRealm.where(AdditionalData.class) .contains("checklistParticipants.email", a@a.com, Case.INSENSITIVE) .equalTo("checklistParticipants.type", 0) .findAll(); which returns me result of similar to ANY record. I want to check in nested query, only return record if and if both condition fulfilled. likewise in nested query, record email must be a@a.com and type=0 i tried below approach but ended up in same result. mRealm.where(AdditionalData.class) .contains("checklistParticipants

Realm add List<> object to already existing object

泄露秘密 提交于 2019-12-25 01:47:24
问题 This is how my Object classes looks like: Workout.swift: class Workout: Object { @objc dynamic var date: Date? // List of exercises (to-many relationship) var exercises = List<Exercise>() } Exercise.swift class Exercise: Object { @objc dynamic var name: String? // List of sets (to-many relationship) var sets = List<Set>() var parentWorkout = LinkingObjects(fromType: Workout.self, property: "exercises") } Set.swift class Set: Object { @objc dynamic var reps: Int = 0 @objc dynamic var kg:

Swift group Realm query results

China☆狼群 提交于 2019-12-25 01:46:21
问题 I've following Realm objects (init and other non-essential properties removed for brevity) in my Swift app @objcMembers class Person: Object { dynamic var id: String = "" dynamic var name: String = "" override static func primaryKey() -> String? { return "id" } } @objcMembers class Project: Object { dynamic var projectId: Int = 0 dynamic var manager: Person? var tasks = List<Task>() dynamic var lastTask: Task? override static func primaryKey() -> String? { return "projectId" } } @objcMembers

Nested Arrays throwing error in realm.create(value: JSON) for Swift

元气小坏坏 提交于 2019-12-25 01:22:28
问题 I'm using Realm in my Swift project and have a rather long JSON file with a couple of nested properties. I'm aware that in order for Realm to use this serialized JSON data directly, the properties need to match exactly (https://realm.io/docs/swift/latest/#json). But because Realm Lists need to have an Object instead of a String, I have to use something like List with Requirement being a Realm Object that holds a single String called 'value'. When I run this code: try! realm.write { let json =